← Back to course
Variables: Boxes That Hold Stuff
The trick
A variable is like a labelled box that stores a piece of information so the program can use it and change it later. In a game, score might be a variable that starts at 0 and goes up when you win points; playerName might hold "Asha". The power of a variable is that it can change while the program runs — that's literally why it's called a "variable." You put a value in, read it, and update it. Almost every program you've ever used relies on variables to remember things: your score, your lives, your username, the time.
Worked examples
🧩 Unplugged activity: Draw three labelled boxes: score, lives, level. Put a starting number in each. Now "play" a round — cross out and update the numbers as things happen. You just used variables!
Practice
…