Branching with IF ... THEN ... ELSE
Chooses between two paths. If the condition is true, action1 runs. If it is false, the ELSE path runs action2 instead. Exactly one of the two paths runs.
Understanding Branching with IF ... THEN ... ELSE in Years 5–6 Creating Digital Solutions
What it does: The condition score >= 10 is true or false. True gives the prize path and false gives the try again path, so there are two outcomes. When the light is green, the THEN path runs and you go. When it is any other colour, the ELSE path runs and you stop. Never both. An IF ... ELSE is meant to choose between two different paths. If both do the same thing, the condition makes no difference.
Common mistakes: ELSE never has its own condition. It just means 'otherwise'. Line 4 should be just ELSE. The keyword for the second path is ELSE, not OTHERWISE. Line 3 should be ELSE.
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 11–20) and word search (Modules 1–20).
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
IF condition THEN action1 ELSE action2Fill in the Blanks
Spot the Error
Student with a class code? Join your class →