Variables in coding worksheet for Years 3–6: Score variable

Members Chapter 5 of Make Your Own Game: Code a Catching Game with Hazel · Year 3, Year 4, Year 5 · 3 pages · PDF, A4

All 7 worksheets in this game

One for each chapter

Score Variable is a printable variables in coding worksheet for Years 3 to 6 (ages 7 to 11) that teaches children to use variables to keep score and count down a timer in a game. It follows the KS2 computing national curriculum in England: work with variables and various forms of input and output.

  • 3 A4 pages
  • Answers sheet
  • About 30 minutes
  • Colour or black and white
  • National curriculum

For members Membership opens every worksheet and every game. Already a member? Log in

Start with the free one: Plan a game (chapter 1).

The game for this worksheet Make Your Own Game: Code a Catching Game with Hazel Chapter 5 · Keep score with a variable · read aloud ▶ Play chapter 5 in the gameChapter 1 is free

Print it on A4, in colour or black and white. Do it after the chapter, or before it to see what your child already knows.

What's on the worksheet

Use variables to keep score and count down: set the score once at the start, change it inside an if, and make a timer count down. Includes a sock basket game at home, and answers.

Page 1 · Learn
Flip explains a variable as a labelled box, with a scoring script and a worked example tracing the score. A warm-up works out the score after set and change blocks.
Page 2 · Try it together
Sock basket: set score to 0 and socks left to 6, throw rolled-up socks into a washing basket, and change the score and the countdown after each throw.
Pages 2–3 · Practise
Trace score and lives, place set and change blocks in a script, fill in a countdown timer and fix a score that keeps resetting. Then a challenge about a score that goes up by itself.
Answers sheet
Every answer by page, what to watch out for (starting value inside the loop, change in the wrong place, counting up) and quick ideas.

3 A4 pages and an answers sheet · about 30 minutes

In the classroom

  • Run Sock basket as a group game with a scorer and a timekeeper, each saying their variable blocks aloud.
  • Practise B makes a good mini-whiteboard check: where does set go, and where does change go?

Questions from the worksheet

  1. set score to 0, then catch, catch, miss, catch. Each catch: change score by 1. What is the score at the end?
  2. Where should each block go? Write 1 or 2: set score to 0, change score by 1.
  3. This timer should count down from 10. Fill the gap. What is time after 3 seconds?
  4. Leo's score goes back to 0 all the time, even after he catches an apple. Why? How would you fix it?

The answers are on the answers sheet, for grown-ups.

National curriculum in England

This worksheet practises this statement from the Years 3–6 computing programme of study:

  • Use sequence, selection, and repetition in programs; work with variables and various forms of input and output

Source: National curriculum in England: computing programmes of study (DfE)

Using it at home

  • Play Sock basket for about 10 minutes and say the blocks out loud: "set score to 0", "change score by 1".
  • Help your child spot the difference between set (a new value) and change (add to the value already there) in the warm-up.

Watch out for

Putting the starting value inside the loop, so the score or timer keeps resetting.
Set the value once, before the loop. Ask "How many times should the score go back to 0?"
Putting change score by 1 in the wrong place, so the score goes up at the wrong times.
It belongs inside the if, so it only runs when there is a catch.
Making a countdown timer count up.
Counting down needs a minus number: change time by -1.

Questions and answers

What is a variable in coding?

A variable is a named store for a value that can change while a program runs. A game might use a variable called score that starts at 0 and goes up by 1 for each catch.

What is the difference between set and change?

Set gives a variable a new value, such as set score to 0. Change adds to the value it already has, such as change score by 1.

More worksheets from Make Your Own Game: Code a Catching Game with Hazel

More Year 3 technology worksheets

One for every chapter of every game, with answers.

Browse them →