You’ve just stepped out of the town square when you spot something glowing in the distance…

snack_one = “Happy Apple Crisps”
snack_two = “Pooble’s Punch Bar”
drink_one = “Sweet Sweet Lemon”
You tilt your head This isn’t just a snack run. This is your next quest.
Stashing the essentials
In programming, we use something called variables to save useful things for later just like a delicious snack box. So our computer can remember things like… The Hero’s health, a high score, or our name.
Each and every variable has two parts: a label (its name), and a value (what’s inside)
And as a developer you can name it anything. That power is in your hands. (Although, it’s best to keep it clear, clean, and simple.)
How to not drop your snacks
We dispensed our snacks and now we’re packing for our long journey.
# So we label our belongings
snack = "rice ball"
tool = "notebook"
monies = 42
Later on, you (or your code) can open the box, read the label, and use what’s inside.
How the Pros pack their bags
If you’ve ever played Animal Crossing, Pokémon, or Skyrim, every time you swipe an item or name a pet or even save your progress. That’s variables at work.
They keep track of your player’s name, your inventory contents, the time of day, and the quests you’ve finished.
Variables are just the way your game remembers. You’ve seen variables in action your whole life. Now you know what they’re called.
Just a taste
You’re still standing in front of the vending machine. You have two more slots in your bag. What do you put inside?
You don’t have to pick a programming language yet. But here’s a secret: storing things, like snacks or names, works almost the same in all of them.
Let’s see how it looks in different “flavors” of code
# Python
snack = "onigiri"
drink = "grape soda"
// JavaScript
let snack = "onigiri"
let drink = "grape soda"
/* C# */
string snack = "onigiri";
string drink = "grape soda";
Once you understand the concept, switching between languages is like ordering your food in an accent. Different words, but the same idea.
So you know how to label your snacks and stash them in a box. That’s the language of memory. But, it looks like this vending machine is out of order now…
I’ll have the yoozh
You trot towards ‘The Silky Spoon’, your favorite late-night café on the corner of Starter Town.

A warm bell jingles as you step inside. The barista looks up, gives a knowing nod, and without you saying a word —
usual = "Milk"
print("Tough night? Finest glass of", usual, "on the house.")
Tough night? Finest glass of Milk on the house.
That’s the magic of a variable: you gave your drink a name in the past (usual
), and now the café remembers it for you.
But let’s say you’re feeling different. Maybe a little more herbal.
usual = "Green Tea" # Replaces our original value of "Milk"!
print("Make it a", usual, "today.")
Make it a Green Tea today.
Variables remember what you assign them — but that memory can be updated as our mood changes.
and just like that, we have a shortcut our computer can use anytime it needs to remember our go-to drink.
Quest Log Updated.
- A variable stores a piece of information
- It has a name (label) and a value (what’s inside)
- Variables can be assigned & reassigned with the
=
operator- You can use variables to track anything your program needs to remember