My 9 year old daughter is heavily interested in science, robots, computers, … She asked me if I could teach her how to program a computer. So, we started with Scratch, a programming language specifically designed for kids.
She likes it a lot, and she enjoys getting visual results fast. Now we came to the point that you need a variable, and I have realized that she has not yet understood what a variable is. Of course, at school, they didn't have the concept of variables in mathematics yet (mind you, she is 9 years old).
I remember that when I learned to program, I was 12 years old, and I had a hard time grasping that, too. Although I'm a professional software developer, and I help other people a lot to learn to program, I find it very difficult to explain it to her in a sense, that she can understand, and that is suitable.
Of course I can say:
It's like a box, where you put the number 9 into it. If I ask you how old you are, then you don't say "9", but you give me the box, and I am going to look it up on my own.
That's an analogy, and she understands it, but it's difficult for her to transfer this idea to Scratch code. It doesn't feel correct.
If I say
It's just a name for a value, and everywhere where you normally would use the value itself, you can now use the name. This has the big benefit that you can change the value, but keep the name.
it feels correct, but it's not easy to grasp any more. To cut a long story short: In contrast to a loop (do this and that for a given number of times) or a decision (if X then Y), variables are way more abstract.
So, how would you explain the concept of a variable to a 9 year old, in a way, that it is easy to grasp AND correct at the same time, i.e. it has a direct relation to writing code?