icon-background-square
New
New
Year 7

Program variables

I can use variables to store values and trace how they change in a program.

icon-background-square
New
New
Year 7

Program variables

I can use variables to store values and trace how they change in a program.

warning

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.

Lesson details

Key learning points

  1. A variable is used to store a value in a program.
  2. A variable can be updated with a new value which replaces the initial value it was assigned.
  3. The value of a variable can be tracked throughout a program.

Keywords

  • Variable - a named piece of data, stored in a memory location in a computer

  • Value - the data a variable holds at a particular time

  • Trace - to track the value a variable holds at any time during a program

Common misconception

The value a variable holds cannot be updated and a computer remembers the previous values of variables.

A variable can be updated during a program. Once the value of a variable is updated in a program, the previous value is overwritten.


To help you plan your year 7 computing lesson on: Program variables, download all teaching resources for free and adapt to suit your pupils' needs...

The story has been modelled with examples in the slide deck. If you would prefer you could note down your class' responses and use these variables instead.
speech-bubble
Teacher tip
equipment-required

Equipment

All pupils require access to devices that have or can access the online version of Scratch. Starter programs are linked to the lesson and can be remixed as required.

copyright

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.
True or false? A subroutine can only be called once in a program.
true
Correct answer: false
Q2.
Which word describes the order in which commands are run during a program?
Correct answer: sequence
algorithm
code
Q3.
What colour is the variables block in Scratch?
Correct answer: orange
blue
purple
green
Q4.
What types of data can a variable hold?
images
Correct answer: text
Correct answer: numbers
Q5.
In a bat and ball game, which of these parts of the game would be stored using a variable?
Correct answer: points scored
movement of the sprite
Correct answer: lives lost
Correct answer: time left
appearance of the stage
Q6.
When is the value of a variable usually set?
Correct answer: at the beginning of a program
throughout the running of a program
at the end of a program
when triggered by an event

4 Questions

Q1.
How many values can a variable hold at any one time?
none
Correct answer: one
two
three
Q2.
When a variable is changed, what happens to the value?
Correct answer: It is replaced by a new value.
It is joined by the new value.
It is added to the new value.
Q3.
What is the name of the built-in variable in Scratch that holds user input?
Correct Answer: answer
Q4.
Which block can be used to combine a variable and a message in Scratch?
Correct answer: join
combine
add