Box of Secrets: Understanding Variables in Code

1 of 4

ICT · My World Quest — full scheme of work · explorer

Box of Secrets: Understanding Variables in Code

3 more
1/4
For grown-ups

Companion summary

Have you ever wondered how a video game remembers your score as you play? Every app on your phone uses variables to store information that keeps changing. Think of a variable like a labelled box — you can put a number in, swap it out, and use it again. When you finish, try creating a variable called "score" and see what happens when you change its value.

The Mystery Box

The Mystery Box

Imagine you have a box with a label on the outside. The label says 'score'. Inside the box you can put any number you like — maybe 0 at the start of a game, then 10 after you answer a question correctly, then 25 a moment later. The box is always called 'score', but what is inside it can change. Here is a question to think about before we start:

💭 Think about this

Can you think of anything in a game or app that needs to keep track of a number that changes — like lives, points, or a timer?