Learning Objectives
- Explain the purpose of procedures.
- Define and call procedures with and without parameters.
- Distinguish formal parameters from argument values.
- Use up to three parameters with suitable data types.
Key Terms
- Procedure
- A named subroutine that performs a task and does not return a value directly.
- Parameter
- A named item in a procedure or function definition that receives a value when called.
- Argument
- The actual value or expression supplied in a call.
- Procedure definition
- The code that gives a procedure its name, parameters and statements.
- Procedure call
- A statement that transfers control to the procedure.

Why Use Procedures
A procedure groups statements for one task under a meaningful name. It supports decomposition, avoids repeated code and makes the main program easier to read.
If the same operation is needed several times, a procedure allows one definition to be called from several places. A correction is made once in the procedure rather than in every copied block.
Procedures also improve testing because each task can be considered separately.
Procedure Without Parameters
The definition is normally placed at the start of the code in Cambridge pseudocode. CALL is a complete program statement. After the procedure finishes, execution returns to the statement after the call.
PROCEDURE DisplayHeading
OUTPUT "Student Report"
OUTPUT "--------------"
ENDPROCEDURE
CALL DisplayHeading
Procedure With Parameters
Size is a formal parameter. The argument 20 is supplied by the call and is used as Size during that execution.
Parameters make one procedure reusable with different data. A later call DisplayLine(40) uses the same code but produces a different result.
PROCEDURE DisplayLine(Size : INTEGER)
DECLARE Count : INTEGER
FOR Count <- 1 TO Size
OUTPUT "-"
NEXT Count
ENDPROCEDURE
CALL DisplayLine(20)
Multiple Parameters And Types
A procedure may have up to three parameters in required examination tasks. Each parameter has an identifier and a data type. The arguments in the call must be in the correct order and compatible with those types.
Meaningful parameter names communicate their roles. PROCEDURE PrintResult(Name : STRING, Mark : INTEGER) is clearer than PROCEDURE P(A : STRING, B : INTEGER).
A parameter exists for that procedure call and should be treated as local to the procedure.
Procedure Versus Function
A procedure performs a task and is called with CALL. It does not return a single value to replace the call in an expression. A function returns one value and is used as part of an expression without CALL.
A procedure can still output information or change work through its statements, but exam answers should preserve the procedural distinction.
Parameter Mapping
| Definition Parameter | Call Argument | Value During Call |
|---|---|---|
| Name : STRING | “Aisha” | Aisha |
| Mark : INTEGER | 72 | 72 |
| ShowGrade : BOOLEAN | TRUE | TRUE |
Worked Examples
Personal Greeting
Question: Define a procedure Greeting with a Name parameter that outputs Hello followed by the name.
- Use PROCEDURE Greeting(Name : STRING).
- Output text and Name.
- Close with ENDPROCEDURE.
- Call with CALL Greeting(“Ali”).
Answer: The argument “Ali” is substituted for parameter Name during the call.
Wrong Call
Question: Why is Greeting(“Ali”) incorrect as a complete procedure statement in Cambridge pseudocode?
- Procedures are invoked using CALL.
- A procedure does not return a value to be used as an expression.
Answer: Write CALL Greeting(“Ali”).
Examination Guidance
- Use CALL for procedures.
- Place parameter data types in the definition.
- Supply arguments in the correct order.
- Use no more than three parameters where a question requires writing.
- Give procedures task-based names.
Common Mistakes
- Calling a procedure without CALL.
- Expecting a procedure call to return a value in an expression.
- Supplying arguments of the wrong type.
- Changing the parameter order.
- Using global variables when clear parameters would make the task reusable.
Knowledge Check
1. What is a procedure?
2. How is a procedure called?
3. What is a parameter?
4. What is an argument?
5. What is the maximum required number of parameters?