Skip to content
Computing · Year 5

Active learning ideas

Nested IF Statements

Active learning works for nested IF statements because students must physically trace logic paths to see how conditions interact. Building and debugging decision trees makes abstract control flow visible and meaningful for Year 5 programmers.

National Curriculum Attainment TargetsKS2: Computing - Programming and Algorithms
25–45 minPairs → Whole Class4 activities

Activity 01

Pair Programming: Game Decision Tree

Pairs sketch a decision tree on paper for a game where a sprite advances if score > 100 and energy > 30. They code nested IFs in Scratch, input test values, and swap to debug partner's code. Discuss improvements as a class.

Explain how nested 'if' statements allow for more detailed decision-making.

Facilitation TipDuring Pair Programming: Game Decision Tree, circulate and ask each pair to explain the first condition evaluated before moving to the nested one.

What to look forProvide students with a scenario: 'A character in a game can only use a special ability if their energy is above 75 AND they have collected at least 3 power-ups.' Ask them to write down the nested IF statement structure (using pseudocode or Scratch blocks) that would control this ability.

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

Activity 02

Collaborative Problem-Solving45 min · Small Groups

Small Groups: Nested Logic Challenges

Groups receive scenario cards, like a shop pricing items by type and stock level. They build nested IF programs, run simulations with varied data, and present one working example to the class for feedback.

Design a program that uses nested selection to respond to multiple conditions.

Facilitation TipIn Small Groups: Nested Logic Challenges, provide whiteboards so students can draw arrows between conditions to show flow.

What to look forPresent two program logic examples: one using a simple IF-ELSE IF-ELSE and another using nested IF statements to achieve a similar outcome. Ask students: 'Which structure is clearer for this specific problem and why? When might one be better than the other?'

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

Activity 03

Collaborative Problem-Solving25 min · Whole Class

Whole Class: Structure Comparison Demo

Display simple IF/ELSE and nested versions on the board or shared screen. Class predicts outputs for given inputs, then codes and tests both in Scratch to compare efficiency and clarity.

Compare the logic of a simple IF/ELSE with a nested IF-ELSE IF-ELSE structure.

Facilitation TipFor Whole Class: Structure Comparison Demo, use colored markers to highlight matching blocks in two different logic structures on the board.

What to look forShow students a short Scratch project or pseudocode that includes a nested IF statement. Ask them to trace the execution path for two different sets of inputs (e.g., score = 10, lives = 3; score = 60, lives = 1) and explain what the program does at each step.

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

Activity 04

Collaborative Problem-Solving30 min · Individual

Individual: Custom Nested Quiz

Each student designs a quiz program with nested IFs for score-based feedback, like praise if correct > 8 and time < 5 minutes. They test alone, then peer-review one condition.

Explain how nested 'if' statements allow for more detailed decision-making.

What to look forProvide students with a scenario: 'A character in a game can only use a special ability if their energy is above 75 AND they have collected at least 3 power-ups.' Ask them to write down the nested IF statement structure (using pseudocode or Scratch blocks) that would control this ability.

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Teach nested IFs by starting with a simple game scenario students care about, then add levels one at a time. Avoid teaching nested IFs in isolation; always connect them to a visible outcome like a sprite’s behavior. Research shows that 9- and 10-year-olds grasp nested logic best when they can test their own changes immediately in a live environment.

Successful learning looks like students confidently nesting conditions to represent real game logic without redundant branches. They can explain the execution order and defend why certain paths are taken or omitted.


Watch Out for These Misconceptions

  • During Pair Programming: Game Decision Tree, watch for students automatically adding ELSE branches to every nested IF even when no default action exists.

    Ask pairs to review their flowchart and mark paths that need no action with a clear label like ‘no bonus’ instead of forcing an ELSE clause.

  • During Small Groups: Nested Logic Challenges, watch for students ignoring indentation and assuming code will still run correctly.

    Have each group re-indent their code on the whiteboard side by side with their flowchart to confirm that each block aligns with its logical level.

  • During Whole Class: Structure Comparison Demo, watch for students believing that the order of checking conditions does not change the outcome.

    Use two different ordered demos on the board and run each with the same inputs, then ask the class to trace the difference step-by-step to see how order affects the result.


Methods used in this brief