Download presentation
Presentation is loading. Please wait.
1
Lesson Objectives Aims Key Words
Be able to understand various programming “paradigms” (models) To understand the use of procedures and functions To be able to define “procedural” programming Key Words
2
Procedural Splitting code in to distinct or manageable chunks
A procedure is a defined section of code with a name: Sub outputValue() 'example method, will output the cars value 'to the console, based on its initial value 'minus a depreciation percentage * age Dim resaleValue As Double Console.WriteLine("The value is:") resaleValue = marketvalue - ((age * 0.2) * 1000) Console.WriteLine("£ " & resaleValue) End Sub
3
Procedural Programs are split in to sections
Called Procedures, Routines, Subroutines or Functions Each will have a specific role in the program and will perform a small subset of tasks This makes design easier and programming more manageable
4
Procedures and functions can be:
Procedural Procedures and functions can be: Called anywhere Called any time Called from within other procedures Recursive in the case of functions
5
Procedural Procedures may be : Called using their names outputValue()
Passed parameters/values Declaration: outputValue(listprice As Double, age As Integer) Call: outputValue(19999, 10)
6
A function works very much like a procedure
Functions A function works very much like a procedure Only it returns (gives back) a value: Function isHeads(coinflip As String) As Boolean If coinflip = "Heads" Then Return True Else Return False End If End Function
7
Examples of procedural languages are:
Basic C Event Driven (GUI VB) is procedural in nature.
8
Coursework It is likely you will make use of procedural programming for your coursework You need to start practising now You can’t practise without a goal Hence why you need to be thinking of a task!
9
Write a VB function that: Takes in a string value
Task Write a VB function that: Takes in a string value Returns a Boolean Value Works out, based on the input: Whether the string contains a space Give your function a sensible name
10
Review/Success Criteria
You should know: What a “paradigm” is What procedural programming is What a procedure is What a function is How to declare both in VB
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.