CASE OF ... ENDCASE (7a)
Runs the statement beside the first value that matches the variable. An optional OTHERWISE clause, placed last, runs if nothing matches. ENDCASE closes the structure.
Understanding CASE OF ... ENDCASE (7a) in IGCSE Computer Science Paper 2
What it does: Each indented line holds one value ("A" or "B") followed by a colon and its statement. The first match is the one that runs. OTHERWISE comes after the cases 1 and 2, so it only runs when Day is neither 1 nor 2. A CASE structure starts with CASE OF followed by the identifier being tested. THEN is used with IF, not CASE. Every CASE OF is closed with ENDCASE. ENDIF closes an IF statement. OTHERWISE must always be last. Move the 2 : OUTPUT "Stop" line above the OTHERWISE line.
Common mistakes: Each case needs a colon between its value and its statement. Line 3 should be 2 : OUTPUT "Stop". The colon is missing after the value 1. The line should be 1 : OUTPUT "Mon".
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 37–46) and word search (Modules 27–46).
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 OFFill in the Blanks
Spot the Error
Student with a class code? Join your class →