Programming · 4 question types
Past paper frequency (2018 to 2024)
This topic accounts for approximately 4% of your exam marks.
Writing and calling procedures/functions with parameters is tested in Paper 2.
A procedure is a named block of code that performs a task without returning a value. It is invoked using the
CALLkeyword.
A procedure with no parameters:
PROCEDURE ProcedureName
// statements that do the work
ENDPROCEDURE
A procedure with (values passed in):
PROCEDURE ProcedureName(Param1 : TYPE, Param2 : TYPE, ...)
// statements that use the parameters
ENDPROCEDURE
Each parameter is named and given a data type, so the procedure knows what kind of value to expect.
Procedures are run using the CALL keyword:
CALL ProcedureName
CALL ProcedureName(Value1, Value2)
The values in brackets are called . Each argument is matched in order to the corresponding parameter in the procedure's definition.
Choose a procedure when the sub-program's job is to do something rather than to compute and return something: