OTHERWISE in a CASE statement (7c)
The last clause in a CASE statement. It runs when the value matches none of the listed cases, e.g. OTHERWISE OUTPUT "Beep". Without it, nothing happens if there is no match.
Understanding OTHERWISE in a CASE statement (7c) in IGCSE Computer Science Paper 2
What it does: The listed cases come first, then OTHERWISE as the final clause, and ENDCASE closes the statement. OTHERWISE acts as a catch-all, so it can report an error for any value not listed, such as an invalid menu choice. CASE uses OTHERWISE as its catch-all clause. ELSE belongs to IF statements. 7 matches none of 1, 2 or 3, so OTHERWISE runs and outputs "Beep". Without OTHERWISE, a CASE with no matching value does nothing and the program carries on.
Common mistakes: The CASE statement must start with CASE OF so the OTHERWISE clause later has a valid CASE to belong to. The line should be CASE OF Key. A CASE statement uses OTHERWISE for the clause that runs when nothing matches, not ELSE. The line should be OTHERWISE OUTPUT "Beep".
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 166–175) and word search (Modules 166–187).
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
OTHERWISEFill in the Blanks
Spot the Error
Student with a class code? Join your class →