Choosing between CASE and IF
Use CASE OF to test one variable against single values, like a menu choice. Use IF for ranges, like grade boundaries, or when conditions combine several variables.
Understanding Choosing between CASE and IF in IGCSE Computer Science Paper 2
What it does: Each case is one single value of Choice with a single statement, which is what CASE is designed for. The condition uses two variables (Age and HasTicket) and a range, so it must be an IF statement. A condition that combines two variables needs IF. CASE only tests one variable against single values.
Common mistakes: Each CASE branch tests one single value, like a menu choice. A range such as 1 TO 2 needs an IF statement. It should be 1 : OUTPUT "Play". OTHERWISE belongs only in a CASE statement. An IF statement uses ELSE for the other branch.
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
CASE OFFill in the Blanks
Spot the Error
Student with a class code? Join your class →