Stash

VARIABLE / STORAGE — *the labeled box that holds a value until you call for it.*

Loading audio…

Press play to listen along. The line being read lights up as you go.

Show full transcript

Loading transcript…

01 Opening
Stash beat 1 of 5

Stash wasn't a fuzzy animal or a talking robot. Stash was a box — a small painted wooden box that sat on the classroom workbench, with a label on its side and a little value visible inside. The label read NAME = X. You could open the box to put a value in, or open it to take a value out. That was the whole of Stash.

"This is Stash," Loop said, patting the box. She always spoke on Stash's behalf, because Stash never pretended to be a person. "Stash is a variable — a labeled box. And I want to be honest with you right away, the way Stash would if it could talk: I am not a mind. I do not think, I do not decide. I hold a value until you call for it. I am a box." A few kids who'd come in nervous — sure that "coding variables" would be something huge and mysterious — sat up a little.

02 Stash
Stash beat 2 of 5

Loop lifted the lid. "Watch. I'll put a value in." She set a card marked 5 inside and closed it. On the little screen behind her, it showed: x = 5. "That's called assignment — putting the value 5 into a box labeled 'x.'" Then she opened the box and held up the 5 for everyone to see. "And this is reference — asking for whatever's in the box right now: print(x) — and out comes 5." She smiled. "A variable has two parts, and only two: a name (the label on the side) and a value (whatever's inside). That's it. Put in, take out."

03 Stash
Stash beat 3 of 5

"Now the part that surprises people," Loop said. She opened the box, took out the 5, and dropped in a card marked 10. The screen updated: x = 10. "Same box. Same label — still 'x.' But brand-new contents. That's reassignment — you can empty the box and refill it whenever you like. The label stays put; the value can change as often as you want." She held up different cards. "And lots of kinds of things can go in the box, not just numbers — a bit of text like "hello", or a whole list of things — depending on the language's rules. The box doesn't care much what you keep in it. It just holds it, steady, until you come back for it."

04 Stash
Stash beat 4 of 5

"Two more things, and they're about being kind to future-you," Loop said, tapping the label. "First — names matter. A good label tells you what's in the box: score, playerName, currentLevel. A lazy label like x or temp or data leaves you guessing later what you even stored." She pointed around the room to imaginary boxes. "Second — scope. Some boxes sit out where the whole program can reach them; others live only inside one little corner — one function's workbench — and vanish when that job is done. Knowing where a box can be reached keeps you from hunting for a value that isn't there." She closed Stash gently. "But under all of it — Stash is still just: box, label, value. Put in, take out, change the contents."

05 Closing
Stash beat 5 of 5

A student who'd been chewing her lip finally asked the thing she'd been dreading: "Is this the part that's really hard? Variables?"

Loop shook her head and opened Stash one more time, showing the plain card inside. "Not hard. Box. Label. Value. Put-in, take-out, change. That's all a variable is." And Stash sat there on the bench, quiet and steady, waiting for the next value — not magical, not a mind, just a reliable place to keep something safe until you called for it.

And the kids who'd come in nervous felt it then — the worry loosening into something calm, and even a little brave. The thing that had seemed mysterious and out of reach had turned out to be as friendly and solid as a box you could hold in your own two hands. That feeling — oh... I can hold onto this. I've got a steady place to keep what matters until I need it — is the warm, quiet thing Stash leaves behind. Chase that steady feeling. Everything else in CodeRealm is built on it.

The CodeRealm ensemble

Stash is part of CodeRealm's distributed-narrative cast. Each character embodies a different curricular primitive; together they teach the full subject.

Kids also liked