Single lesson · Key Stage 3

Variables and selection (true or false conditions) – Year 7 Computing lesson

Pupils learn to use a variable to keep a score and an if block with a true or false condition so the game makes a decision.

Also in a bundle Algorithms and Block Programming – Year 7 Computing lessons 6 lessons for £20 · save 16% on buying separately

Lesson 5 of 6 in unit 7.2 Algorithms and Block Programming, taught in Year 7, Autumn 2. It answers one big question: How can a game keep score and make decisions?

By the end, pupils can use a variable to keep a score and an if block with a true or false condition so the game makes a decision.

The Build (the main task)
Write a script that keeps checking whether the player touches a star and, if it does, adds 1 to the score and moves the star.
Support version
Part-filled script: the forever and if blocks are in place; pupils choose the condition and the two blocks inside from a block bank.
Challenge
Add a lives variable that goes down by 1 when the player touches a wall, and explain why it starts at 3.
Real-world link
A traffic light decides when to change and a sat-nav decides whether to reroute; the mini game decides whether the player is touching a star and adds to the score.
Key words
Variable, Selection and Decision, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“An if block keeps watching for its condition all through the game”; “'set score to 1' and 'change score by 1' do the same thing”.
National Curriculum
NC1 (design, use and evaluate abstractions that model real-world problems and physical systems); NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions); NC4 (boolean logic (AND, OR, NOT) in circuits and programming; binary numbers, addition and conversion).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Algorithms and Block Programming unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Variables and selection (true or false conditions) - Quiz Quiz Trade Cards
  • Single-teacher licence: use and adapt it with your own classes

More for KS3 Computing

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.