← Years 5–6 Creating Digital Solutions

Making a variable

A block button that creates a named box to store a value, like a score. You choose a clear name, and a tick box shows or hides the variable on the stage.

Understanding Making a variable in Years 5–6 Creating Digital Solutions

What it does: The name lives left says exactly what the box holds, so anyone reading the script understands it. An empty tick box means the variable still exists and works, but it is not shown on the stage. A clear name like score tells everyone what the variable stores. Names like x1 do not explain anything. Make a Variable creates a named storage place. Motion blocks are the ones that move sprites. Hiding a variable only removes the display. The variable still stores its value and can be used in scripts. Describing names such as high score make it easy for you and others to understand your program.

Common mistakes: The variable was made with the name score, but this line uses scor. A variable name must match exactly. It should be: set score to 0. The goal is to show the score on the stage, but this block hides it. It should be: show variable score.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 41–50) and word search (Modules 41–74).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which variable name is clearest for storing a player's points in a game?
x1score
Matches
Make a Variable: x
↓
The name x is not clear. It does not tell you what the variable stores. A better name is score or lives left.
Applying
Meanings
Term
Make a Variable
Meaning
A block button that creates a named box to store a value, like a score. You choose a clear name, and a tick box shows or hides the variable on the stage.
Practice
make a variable [score]
Testing
Gaps
Click , then type a name
Check Answer
Spots
1Make a Variable: score
2set scor to 0

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Owl' badge — Wise Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which variable name is clearest for storing a player's points in a game?
A. x1
B. score ✓
A clear name like score tells everyone what the variable stores. Names like x1 do not explain anything.
2. What does the Make a Variable button do?
A. Creates a named box that can store a value ✓
B. Moves a sprite across the stage
Make a Variable creates a named storage place. Motion blocks are the ones that move sprites.
3. You want to keep track of how many lives a player has left. Which name is best?
A. lives ✓
B. thing
The name lives matches what the variable holds. A vague name like thing makes your code hard to read.
4. A variable called timer is ticked in the variable list. What happens?
A. The variable is deleted
B. Its value is shown on the stage ✓
The tick box shows the variable on the stage. Unticking it hides the variable but keeps it.
5. You untick the box next to the score variable. What happens to score?
A. It is hidden from the stage but still exists ✓
B. It is erased and cannot be used
Hiding a variable only removes the display. The variable still stores its value and can be used in scripts.

Match the Pairs

Make a Variable → Creates a new named box that can store a value, such as a score
[x] score (tick box) → Shows the score variable on the stage so the player can see it
A clear name tells you what the variable stores → Make a Variable: lives left
Hide a variable from the stage by unticking its box → [ ] score (box unticked)
Make a Variable: x → The name x is not clear. It does not tell you what the variable stores. A better name is score or lives left.
Player cannot see the score, but the score box is ticked and the variable is made → This is not the real problem. The score would show on the stage if the box is ticked. A player who can't see it means the box is unticked, so tick it to show the variable.

Key Term

Make a Variable
A block button that creates a named box to store a value, like a score. You choose a clear name, and a tick box shows or hides the variable on the stage.

Fill in the Blanks

1. Click Make a Variable, then type a name
Hint: Type the name of the button that creates a new storage place.
2. // counts the points a player earns Make a Variable named score
Hint: Type a clear name that describes what the comment says is stored.
3. show variable [score]
Hint: Type the word that makes the variable appear on the stage.
4. hide variable [score]
Hint: Type the word for the named storage place being hidden.
5. Untick the box to hide score on the stage
Hint: Type the action that happens to the variable when its tick box is cleared.

Spot the Error

Question 1
A Make a Variable: score
B set scor to 0
C show variable score
Line B — The variable was made with the name score, but this line uses scor. A variable name must match exactly. It should be: set score to 0
Question 2
A Goal: show the score on stage
B Make a Variable: score
C when green flag clicked
D hide variable score
Line D — The goal is to show the score on the stage, but this block hides it. It should be: show variable score
Question 3
A Make a Variable: lives
B when green flag clicked
C set 3 to lives
Line C — The set block needs the variable name first and then the value. It should be: set lives to 3
Question 4
A Make a Variable: time left
B when green flag clicked
C set time to 30
D show variable time left
Line C — The variable is called time left, not time. The name must match exactly, so it should be: set time left to 30
Question 5
A Make a Variable: x
B set score to 0
C show variable score
Line A — The name x does not tell us what is stored, and it does not match the later lines. Choose a clear name: Make a Variable: score

Student with a class code? Join your class →