Variables in coding worksheet for Years 5–6: What is a variable?
All 5 worksheets in this game
One for each chapter
What Is a Variable? is a printable coding worksheet for Years 5 and 6 (ages 9 to 11) that teaches children that a variable has a name and stores one value, which a new value replaces. It follows the national curriculum in England for Key Stage 2 computing: use sequence, selection and repetition in programs, and work with variables and various forms of input and output.
- 3 A4 pages
- Answers sheet
- About 25 minutes
- Colour or black and white
- National curriculum
Free to print, no account needed.
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
Learn that a variable has a name and stores one value, and that setting it again replaces the old value. Includes a cup variables activity with paper slips, block-code tracing and an answers sheet.
- Page 1 · Learn
- Variables shown as labelled boxes (score, lives, name), a worked trace of three set blocks with a table, Flip's tip on names and values, and a warm-up.
- Page 2 · Try it together
- Cup variables: label three cups score, lives and name, follow six set instructions with paper slips, and record what is in every cup after each one.
- Pages 2–3 · Practise
- Sort words into variable names and values, trace three block scripts, answer four true-or-false statements and explain why games keep the score in a variable.
- Answers sheet
- Every answer by page, what to watch out for (keeping old values, mixing up name and value) and ideas to go further.
3 A4 pages and an answers sheet · about 25 minutes
In the classroom
- Run Cup variables at the front with three labelled cups while the class predicts each value on mini whiteboards.
- Use the true-or-false statements as a quick hands-up check at the end of a lesson.
Questions from the worksheet
- A variable can store lots of values at the same time. True or false?
- When you set a variable, the old value is replaced. True or false?
- Why do games keep the score in a variable, not a fixed number?
- Leo runs set lives to 3, then set lives to 2. He says, "Now lives stores 3 and 2." Is he right? Explain.
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
- Do Cup variables before the Practise pages: taking the old slip out of the cup makes it clear why a variable only keeps its newest value.
- Ask your child to point to the name and the value in each block as they trace it. The sheet takes about 25 minutes.
Watch out for
- Thinking a variable keeps its old values as well as the new one.
- Use the cups: there is room for one slip, so the old one comes out when a new value goes in.
- Mixing up a variable's name and the value stored in it.
- The name is the label on the box (score); the value is what is inside it (12).
Questions and answers
What is a variable in coding for kids?
A variable is a named place in a computer's memory that stores one value, such as a score, a number of lives or a name. The value can change while the program runs.
What happens when you set a variable again?
The new value replaces the old one. After set score to 5 and then set score to 8, score stores only 8.
More worksheets from Variables in Coding: Build Scores and Timers with Bit
More Year 5 technology worksheets
One for every chapter of every game, with answers.
