Local variables
Creates a local variable inside a procedure or function, e.g. DECLARE Length : INTEGER. It exists only while the subroutine runs and cannot be used in the main program.
Understanding Local variables in IGCSE Computer Science Paper 2
What it does: Result is declared with DECLARE inside the function body, so it is local to Double and exists only while Double runs. A local variable is created when the subroutine is called and stops existing when the subroutine ends. This is different from a global variable. Parameters are local to their subroutine, so Width cannot be used in the main program.
Common mistakes: A local variable is declared with DECLARE, a name, a colon and a data type. The colon is missing. It should be DECLARE Area : INTEGER. DIM is not the pseudocode keyword for declaring a local variable. Inside a procedure it must be DECLARE Count : INTEGER.
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 419–428) and word search (Modules 419–438).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
DECLAREFill in the Blanks
Spot the Error
Student with a class code? Join your class →