CASE OF ... ENDCASE (7c)
Compares one variable with a list of single values and runs the statement for the first match only. Each case is indented two spaces and the structure ends with ENDCASE.
Understanding CASE OF ... ENDCASE (7c) in IGCSE Computer Science Paper 2
What it does: The case 'W' is indented two spaces under CASE OF. It runs Position ← Position - 10 when Direction is 'W', and ENDCASE closes the structure. A CASE statement starts with CASE OF followed by the identifier. THEN is used in IF statements, not in CASE. CASE tests one identifier against single values such as 'W', 'E' or 'N'. The 'W' case subtracts 10 from Position, so 50 - 10 = 40. CASE OF is followed by the one variable being compared. Each case below it is a value that Direction might hold. Every CASE OF must be closed with ENDCASE, just as IF is closed with ENDIF.
Common mistakes: The OF keyword is missing. A CASE statement must start CASE OF followed by the identifier, so the line should be CASE OF Key. The colon is missing after the case value. Each case needs a value, then a colon, then the statement: 'S' : Pos ← Pos + 10.
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 156–165) and word search (Modules 146–165).
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
CASE OF ... ENDCASEFill in the Blanks
Spot the Error
Student with a class code? Join your class →