Skip to content

Introducing VariablesActivities & Teaching Strategies

Active learning works for introducing variables because students need to physically manipulate and visualize data containers to grasp their purpose. Moving items in and out of boxes, naming variables aloud, and auditing real games make abstract concepts tangible and memorable.

Year 5Computing3 activities15 min30 min

Learning Objectives

  1. 1Identify the purpose of a variable as a named container for data that can change.
  2. 2Demonstrate how to initialise a variable with a starting value in a simple program.
  3. 3Explain how changing the value of a variable affects the output or behaviour of a program.
  4. 4Critique the choice of variable names in provided code snippets for clarity and accuracy.

Want a complete lesson plan with these objectives? Generate a Mission

20 min·Whole Class

Simulation Game: The Variable Boxes

Place several empty boxes at the front of the room, each labeled with a name like 'Score' or 'Lives'. Students act as the 'program' and follow instructions to put different numbers of counters into the boxes or swap them, demonstrating how the value changes but the name stays the same.

Prepare & details

Justify why we must set a variable to a starting value at the beginning of a game.

Facilitation Tip: During The Variable Boxes, circulate to ensure each student places only one item in each box and replaces it intentionally to model overwriting.

Setup: Flexible space for group stations

Materials: Role cards with goals/resources, Game currency or tokens, Round tracker

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
15 min·Pairs

Think-Pair-Share: Naming Conventions

Show students a list of 'bad' variable names (e.g., 'x', 'thing', 'stuff') and 'good' names (e.g., 'player_score', 'timer_seconds'). Pairs must discuss why the good names make the code easier to read and then rename a set of mystery variables based on their function.

Prepare & details

Explain how one variable can be used to control multiple different sprites.

Facilitation Tip: In Naming Conventions, pause pairs after two minutes of discussion to call on one group to share their top naming rule with the class.

Setup: Standard classroom seating; students turn to a neighbor

Materials: Discussion prompt (projected or printed), Optional: recording sheet for pairs

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
30 min·Small Groups

Inquiry Circle: Game Audit

Groups look at screenshots of popular games (like Minecraft or Roblox) and identify every piece of information on the screen that would need to be stored in a variable. They present their list, explaining why each variable needs a starting value.

Prepare & details

Critique the impact of a confusing or inaccurate variable name on a program.

Facilitation Tip: For Game Audit, provide printed game screenshots with clear variables already labeled so students focus on identifying purpose rather than creating labels.

Setup: Groups at tables with access to source materials

Materials: Source material collection, Inquiry cycle worksheet, Question generation protocol, Findings presentation template

AnalyzeEvaluateCreateSelf-ManagementSelf-Awareness

Teaching This Topic

Teach variables by starting with physical models before moving to code, as research shows concrete examples reduce misconceptions. Avoid abstract explanations like 'memory location' with younger students, and always pair naming with purpose to prevent the belief that variable names control behavior. Use consistent language such as 'holds' or 'stores' to reinforce the container analogy.

What to Expect

Successful learning looks like students confidently defining variables with clear names and initial values, explaining why a variable can only hold one value at a time, and justifying their naming choices during discussions. They should also apply variables in simple programs without confusion.

These activities are a starting point. A full mission is the experience.

  • Complete facilitation script with teacher dialogue
  • Printable student materials, ready for class
  • Differentiation strategies for every learner
Generate a Mission

Watch Out for These Misconceptions

Common MisconceptionDuring The Variable Boxes, watch for students trying to put multiple items into a single box at the same time.

What to Teach Instead

Give each pair two boxes and instruct them to place one item in each box, then replace items one at a time to demonstrate that only one value fits at once. Ask: 'What happened to the first item when you put in the second one?'

Common MisconceptionDuring Naming Conventions, listen for students assuming that a variable name like 'speed' automatically makes the character move fast.

What to Teach Instead

Show a program where 'speed' is set to 0 at the start, then ask students to predict what happens if the value changes to 5. Point out that the name does not control the action; the value and logic do.

Assessment Ideas

Quick Check

After The Variable Boxes, ask students to hold up their boxes when you name a variable, showing the current item as its value. Call out a change, like 'Now the variable 'coins' holds 3,' and watch if they replace the item correctly.

Discussion Prompt

During Game Audit, ask each group to explain one variable they found and why its name made sense for its purpose. Listen for connections between the name, the value, and how it changes in the game.

Exit Ticket

After all activities, give students a slip to write the name and starting value of a variable they would use to track lives in a game, and one sentence explaining why they chose that name.

Extensions & Scaffolding

  • Challenge: Ask students to write a short program that uses at least three variables to track different game elements, like lives, score, and level.
  • Scaffolding: Provide pre-labeled variable boxes with pictures (e.g., a heart for lives) so students can focus on the concept rather than naming.
  • Deeper exploration: Have students research how variables are used in a game they play and present one example of a variable that changes during gameplay.

Key Vocabulary

VariableA named storage location in a computer program that holds a value. This value can change while the program is running.
InitialiseTo set a variable to a specific starting value before it is used in a program. This ensures the program begins with predictable data.
Data TypeThe kind of data a variable can hold, such as a number (integer or decimal) or text (string).
AssignThe action of giving a value to a variable, either when it is first created or later in the program.

Ready to teach Introducing Variables?

Generate a full mission with everything you need

Generate a Mission