New
New
Year 5

Using selection to control the flow of a program

I can use a loop to repeatedly check whether a condition has been met.

New
New
Year 5

Using selection to control the flow of a program

I can use a loop to repeatedly check whether a condition has been met.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. Coding projects can have conditions and actions.
  2. A condition being met can be used to start an action.
  3. Selection can be used to control the flow of a program.

Keywords

  • Condition - a statement that can be either True or False

  • Selection - part of a program where if a condition is met, then a set of commands is run

Common misconception

If… then… statements can be checked once in a program.

An if... then... statement can be made to repeatedly check a condition by using a forever loop.


To help you plan your year 5 computing lesson on: Using selection to control the flow of a program, download all teaching resources for free and adapt to suit your pupils' needs...

This lesson includes opportunities to demonstrate the use of the Crumble programming software. Pedagogically, it is beneficial to demonstrate the concepts to students first-hand, as it encourages questions and enhances understanding.
Teacher tip

Equipment

Crumble controller, Sparkle LED, battery pack, crocodile clips, push button switch

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is a condition in programming?
Correct answer: a statement that can be True or False
a set of instructions
a loop that repeats code
a type of error in the program
Q2.
What does a conditional loop do?
stops the program
Correct answer: repeats code until a condition is met
jumps to another part of the program
runs code only once
Q3.
Which of these is an example of a condition?
the program runs
the microcontroller turns on
a loop stops repeating
Correct answer: if the button is pressed
Q4.
What is the purpose of a microcontroller?
to display images
to store large amounts of data
Correct answer: to respond to inputs
to connect to the internet
Q5.
What does True mean in programming?
a loop is running
a program has stopped
Correct answer: a condition is met
an error has occurred
Q6.
Put these steps in order to program a microcontroller.
1 - write the program
2 - upload the program to the microcontroller
3 - run the program

6 Questions

Q1.
Match the terms to their examples.
Correct Answer:condition,If the button is pressed, ...

If the button is pressed, ...

Correct Answer:selection,If the temperature is below 20°C, turn on the heater.

If the temperature is below 20°C, turn on the heater.

Correct Answer:True,The light is on.

The light is on.

Correct Answer:False,The button is not pressed.

The button is not pressed.

Q2.
What type of loop repeatedly checks a condition?
Correct Answer: forever, forever loop
Q3.
What is a condition in programming?
Correct answer: a statement that can be True or False
a set of commands
a loop that repeats code
a type of error in the program
Q4.
What is selection in programming?
a loop that repeats code
a method for storing data
Correct answer: a way to control program flow based on conditions
a tool to refine search terms
Q5.
What is the purpose of an if… then… statement?
to repeat code
to store data
Correct answer: to check a condition and run commands if the condition is met
to create a loop
Q6.
Selection allows a program to make decisions by checking a .
Correct Answer: condition