← IGCSE Computer Science Paper 2

Pseudocode PROCEDURE ... ENDPROCEDURE and CALL

Defines a named block of pseudocode for one sub-problem. It does not return a value. The block only runs when you write CALL Name() in the main program.

Understanding Pseudocode PROCEDURE ... ENDPROCEDURE and CALL in IGCSE Computer Science Paper 2

What it does: Empty brackets mean the procedure takes no parameters, and ENDPROCEDURE marks the end of the block. Each CALL runs one procedure, so the main program mirrors the boxes in the structure diagram. A procedure begins with the keyword PROCEDURE, then its name and brackets. FUNCTION ... RETURNS is used when a value must be sent back. Pseudocode uses the keyword CALL to run a procedure. RUN is not a Cambridge pseudocode keyword.

Common mistakes: Cambridge pseudocode uses OUTPUT to display text, not PRINT. The line should be OUTPUT "1. Play". The block ends with ENDPROCEDURE, so it must start with PROCEDURE, not FUNCTION. The line should be PROCEDURE Greet().

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 123–134) and word search (Modules 123–145).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which line correctly starts a procedure called ShowMenu that has no parameters?
FUNCTION ShowMenu() RETURNSPROCEDURE ShowMenu()
Matches
PROCEDURE ShowMenu() OUTPUT "1. Play" ENDFUNCTION
↓
The procedure is closed with ENDFUNCTION. A procedure must end with ENDPROCEDURE.
Applying
Meanings
Term
PROCEDURE Name() ... ENDPROCEDURE
Meaning
Defines a named block of pseudocode for one sub-problem. It does not return a value. The block only runs when you write CALL Name() in the main program.
Practice
PROCEDURE ShowMenu()
Testing
Gaps
ShowMenu()
Check Answer
Spots
1PROCEDURE ShowMenu()
2 PRINT "1. Play"

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Space Turtle' badge — Speed in Zero-G, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which line correctly starts a procedure called ShowMenu that has no parameters?
A. PROCEDURE ShowMenu() ✓
B. FUNCTION ShowMenu() RETURNS
A procedure begins with the keyword PROCEDURE, then its name and brackets. FUNCTION ... RETURNS is used when a value must be sent back.
2. Which keyword closes a procedure definition?
A. ENDFUNCTION
B. ENDPROCEDURE ✓
Every PROCEDURE must finish with ENDPROCEDURE. ENDFUNCTION closes a FUNCTION.
3. How do you run a procedure called ShowMenu in the main program?
A. CALL ShowMenu() ✓
B. RUN ShowMenu()
Pseudocode uses the keyword CALL to run a procedure. RUN is not a Cambridge pseudocode keyword.
4. A procedure is written but the main program never contains a CALL to it. What happens?
A. The procedure never runs ✓
B. The procedure runs automatically at the start
Defining a procedure only stores the block of code. It only runs when CALL Name() is written.
5. A structure diagram has three boxes below the top box: GetMarks, CalcAverage and ShowResult. How many procedures would you normally write?
A. One, containing all the code
B. Three, one per box ✓
Each box is one sub-problem, so each gets its own procedure. The main program then CALLs each one in turn.

Match the Pairs

PROCEDURE ShowMenu() OUTPUT "1. Play" ENDPROCEDURE → Defines a procedure called ShowMenu with no parameters. Its block of code does not run yet.
CALL ShowMenu() → Runs the procedure called ShowMenu from the main program.
A procedure with no parameters is defined with empty brackets after its name and closed with ENDPROCEDURE. → PROCEDURE GetScores() INPUT Score ENDPROCEDURE
A main program uses CALL once for each sub-problem box of the structure diagram, each box being a procedure. → CALL GetScores() CALL CalcAverage() CALL ShowResult()
PROCEDURE ShowMenu() OUTPUT "1. Play" ENDFUNCTION → The procedure is closed with ENDFUNCTION. A procedure must end with ENDPROCEDURE.
ShowMenu() → CALL is missing, so this does not correctly run the procedure. It should be CALL ShowMenu().

Key Term

PROCEDURE Name() ... ENDPROCEDURE
Defines a named block of pseudocode for one sub-problem. It does not return a value. The block only runs when you write CALL Name() in the main program.

Fill in the Blanks

1. PROCEDURE ShowMenu() OUTPUT "1. Play" ENDPROCEDURE
Hint: Type the keyword that starts the definition of a named block of code that does not return a value.
2. PROCEDURE ShowMenu() OUTPUT "1. Play" ENDPROCEDURE
Hint: Type the keyword that closes the procedure definition.
3. OUTPUT "Start" CALL ShowMenu() OUTPUT "End"
Hint: Type the keyword the main program uses to run a procedure.
4. CALL ShowMenu() INPUT Choice CALL ShowMenu()
Hint: Type the name of the procedure that is called on the first line, so it runs again.
5. PROCEDURE GetAge() INPUT Age ENDPROCEDURE
Hint: Type the pseudocode keyword that reads a value from the user inside this procedure body.

Spot the Error

Question 1
A PROCEDURE ShowMenu()
B PRINT "1. Play"
C ENDPROCEDURE
D CALL ShowMenu()
Line B — Cambridge pseudocode uses OUTPUT to display text, not PRINT. The line should be OUTPUT "1. Play".
Question 2
A FUNCTION Greet()
B OUTPUT "Hello"
C ENDPROCEDURE
D CALL Greet()
Line A — The block ends with ENDPROCEDURE, so it must start with PROCEDURE, not FUNCTION. The line should be PROCEDURE Greet().
Question 3
A PROCEDURE ReadScore()
B INPUT Score
C ENDFUNCTION
D CALL ReadScore()
Line C — A PROCEDURE must be closed with ENDPROCEDURE. ENDFUNCTION is only used to close a FUNCTION.
Question 4
A PROCEDURE Show Total()
B OUTPUT Total
C ENDPROCEDURE
D CALL ShowTotal()
Line A — A procedure name cannot contain a space. It should be one word, PROCEDURE ShowTotal(), so that CALL ShowTotal() can find it.
Question 5
A PROCEDURE InputData()
B INPUT Age
C ENDPROCEDURE
D RUN InputData()
Line D — A procedure is run with the keyword CALL, not RUN. The line should be CALL InputData().

Student with a class code? Join your class →