CASE clauses with ranges and several statements
In a CASE clause, value1 TO value2 matches a whole range, such as 1 TO 9. Indented statements under the clause all run. Ranges in one CASE must not overlap.
Understanding CASE clauses with ranges and several statements in IGCSE Computer Science Paper 2
What it does: The range is written as value1 TO value2, followed by a colon and the statement to run. The ranges 0 TO 49 and 50 TO 100 share no values, so every mark matches exactly one clause. A CASE clause lists values or a range using TO. It does not use relational operators like < in the clause. Ranges in one CASE must not overlap. In the wrong pair, 50 would match both clauses. All the indented statements under a matching clause run, one after the other. Range ends are included. 75 is the first value of 75 TO 100 and is outside 50 TO 74.
Common mistakes: A range in a CASE clause is written with TO, not a hyphen. It should be 40 TO 69 : OUTPUT "B". The colon is missing after the range. A clause must be written 1 TO 9 : OUTPUT "Low".
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 369–378) and word search (Modules 358–378).
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
1 TO 9 :Fill in the Blanks
Spot the Error
Student with a class code? Join your class →