Play CodeRealm

Stash

VARIABLE / STORAGE

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.

Hear it as an audio drama

A short play starring Stash, from CodeRealm. Different voices, same idea. Listen any time after you read.

Loading audio…

Read the drama script
  1. Narrator: From Spark and Anvil and CodeRealm — this is Stash, in chapter 1 of the CodeRealm cast.
  2. Narrator: This drama uses an AI-generated voice. Voiced via Gemini 2.5.
  3. Narrator: Stash is a small wooden box. It is painted a calm, unassuming grey.
  4. Narrator: A crisp white label is on its side. Through a small window on top, a value is visible inside.
  5. Stash: I am Stash. I am a labeled box that holds a value. That is what I am.
  6. Narrator: The label is the name. The thing inside is the value. This is the variable idea.
  7. Stash: My label is my name. The value inside is my contents. I hold it until you call for it.
  8. Stash: You put a value in. You take a value out. You can change the value. The label stays the same.
  9. Narrator: Stash was presented to the CodeRealm students by their mentor, Loop.
  10. Narrator: Loop held the box and asked the class a simple, important question.
  11. Stash: Is Stash clever? Does it think? Does it decide what to hold?
  12. Stash: No. I am not a mind. I am a box.
  13. Stash: Box. Label. Value. Put-in. Take-out. Change. That is the whole operation.
  14. Narrator: A name for a place. A place for a value. That's what makes Stash Stash.
  15. Narrator: You've been listening to a Spark and Anvil chapter, written by the Spark and Anvil writing team for ages 9 to 14.
  16. Narrator: Spark and Anvil is a 501(c)(3) public charity. Apps stay free forever.
  17. Narrator: Curriculum aligned to Computer Science Teachers Association standards.
  18. Narrator: Released under Creative Commons BY-NC-SA 4.0 for educational reuse. Visit Spark and Anvil for the full transcript.

The CodeRealm ensemble

Stash is one of the friends in CodeRealm. Each friend shows you one idea by how they act; meet them all and you have the whole subject.

Kids also liked