Staffroom
Lesson Plans/Computing/Year 4/Selection in Programming
Year 4ComputingKS2

Selection in ProgrammingYear 4 Lesson Plan

National Curriculum: Computing KS2 — use sequence, selection and repetition in programs; work with variables and various forms of input and output

Overview

Pupils learn to use selection (if/then/else) in programs to make decisions based on conditions. They explore how a computer evaluates a condition as true or false and executes different code depending on the result. Using Scratch, they create interactive programs that respond differently to different inputs.

Learning Objectives

  • Understand what selection means in programming and why it is used.
  • Identify conditions and outcomes in if/then/else structures.
  • Use an if/else block in Scratch to make a program respond to different conditions.
  • Debug programs that use selection to ensure they behave as intended.

Key Vocabulary

selection
A programming structure that chooses between two or more paths based on a condition
condition
A statement that is either true or false (e.g. score > 10)
if/then
If a condition is true, then run this code
else
The code that runs when the condition is false
Boolean
A value that is either true or false
variable
A named container in a program that stores a value

Suggested Lesson Structure

10m
Warm-up

Real-world selection: 'If it is raining, then I put on a coat, else I wear a T-shirt.' Can pupils give three more if/else examples from daily life? Establish: computers do this too — they make decisions.

20m
Teaching input

In Scratch, demonstrate an if/else block. Show a simple example: if the sprite touches red, play a sound; else, move forward. Trace through the logic: the computer checks the condition — if true, path A; if false, path B. Introduce the concept of a Boolean: every condition is either true or false, nothing in between. Demo a quiz program: if the answer equals the correct word, say 'Well done!', else say 'Try again.'

15m
Guided practice

Pupils modify a starter Scratch project that includes a broken if/else block. Their task: find the bug, fix the condition, and test. Teacher circulates: 'What is the condition? What should happen if it's true? If it's false?'

10m
Independent practice

Pupils extend their quiz program to include at least two if/else blocks (e.g. check the answer, then check the score and say something different depending on whether it's above or below 5). They must predict the behaviour before testing.

5m
Plenary

Pair demo: one pupil explains their if/else in plain English; the other traces through the Scratch code to verify. Class discussion: how is selection different from sequence and loops? When do we need all three?

Common Misconceptions

  • Pupils sometimes write conditions that can never be true (e.g. if x = 5 AND x = 6) — conditions must be logically possible.
  • Thinking 'else' is optional — if there is no else branch and the condition is false, nothing happens; sometimes that is intentional, sometimes it is a bug.

Prior Knowledge

Pupils should already be able to:

  • Experience using sequences and loops in Scratch.
  • Basic understanding of variables as named storage.
  • Logical reasoning skills from maths and science.

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 →