Staffroom
Lesson Plans/Computing/Year 4/Further Programming — Loops and Selection
Year 4ComputingKS2

Further Programming — Loops and SelectionYear 4 Lesson Plan

National Curriculum: Computing KS2 — design, write and debug programs that accomplish specific goals, decomposing problems into smaller parts; use sequence, selection, and repetition in programs; use logical reasoning to detect and correct errors in algorithms and programs.

Overview

Pupils revisit loops and selection as separate concepts before exploring how they can be combined within a single program. Using Scratch, they design a program with a flowchart, build it by integrating loops with if/else selection blocks, and evaluate it against a written specification. The unit develops systematic design skills, reinforcing that planning before coding leads to fewer bugs and a clearer program structure.

Learning Objectives

  • Explain the difference between a loop and a selection (if/else) and describe when each is used.
  • Design an algorithm using a flowchart that combines loops and selection.
  • Build a Scratch program that uses both a loop and an if/else block working together.
  • Evaluate a program against a specification and suggest at least one improvement.

Key Vocabulary

loop
A structure that repeats a set of instructions a fixed number of times or until a condition is met.
selection
A structure that allows a program to choose between two paths using a condition.
condition
A question with a true or false answer that determines which path a program takes.
nest
To place one structure (such as a selection) inside another (such as a loop).
flowchart
A diagram that shows the steps and decisions in an algorithm using shapes and arrows.
specification
A description of what a program must do, used to check the finished program.

Suggested Lesson Structure

10m
Warm-up

Quick-fire oral review: teacher describes a scenario and pupils call out 'loop' or 'selection'. Examples: 'do this 10 times' (loop); 'if it is raining, take an umbrella, otherwise do not' (selection); 'keep going until you reach the wall' (loop); 'if the score is above 10, show a win message' (selection). Establish: both can appear in the same program.

20m
Teaching input

Open Scratch and build a demonstration program together: a sprite that moves forward 10 steps inside a 'repeat 10' loop, and inside each loop checks if it is touching the edge — if so, it bounces back. Explain the flowchart equivalent using a prepared diagram: the loop is the outer box, the if/else is the diamond inside it. Run the program and trace through the flowchart simultaneously, marking which path is taken on each iteration. Introduce the term 'nested selection inside a loop'.

15m
Guided practice

Pupils are given a printed flowchart for a simple Scratch program: a sprite patrols left and right, and if it touches a target sprite, a score variable increases by 1. Pupils work in pairs to build the program in Scratch from the flowchart. Encourage them to build and test one component at a time — loop first, then add the condition.

10m
Independent practice

Pupils design a program specification for their own small game or simulation that must use at least one loop and one if/else selection. They complete a planning sheet (what the program does, the flowchart, and what they will need). They then begin coding. Finished programs are saved and labelled clearly.

5m
Plenary

Display two Scratch programs on the board: one that uses a loop without selection and one that uses both. Ask pupils to explain in pairs what is the same and what is different. Collect responses. Ask: which program can respond to what is happening? Why does that make it more useful? Summarise the lesson: programs that combine loops and selection are more powerful because they can react to changing situations.

Common Misconceptions

  • Pupils often place the if/else block outside the loop, meaning the check only happens once rather than on every iteration — use the flowchart to trace through and show why the diamond must be inside the loop shape.
  • Some pupils confuse a 'repeat until' loop (which already contains a condition) with an if/else block — clarify that 'repeat until' stops the loop, whereas if/else chooses between two different actions.

Prior Knowledge

Pupils should already be able to:

  • Ability to use count-controlled loops in Scratch from Year 3.
  • Ability to use if/else selection blocks in Scratch from Year 4 Autumn 1.

Want a personalised version of this lesson?

Use Staffroom to generate a complete lesson plan tailored to your class — add context about ability, recent learning, or specific pupils and get a plan ready to teach. Free trial, no card required.

Try Staffroom free →