Answers.Body: <p>Do you use a dry-erase board anywhere to keep track of chores, or a shopping list?</p>
  
  <p>An <em>erasable space</em> is a great way to teach the use of a variable.</p>
  
  <p>You can even get into data types!</p>
  
  <p>Booleans - eg: a tick in a box or the words <em>yes/no</em> against a task <em>trash taken out</em>. I know one mum who had a checklist at the door, so ticking off everything on the list would be essential before going to school, then the list gets erased back to <em>all false</em> on getting home, ready for the next day.</p>
  
  <p>Integers - have a box for number of times someone has to dry dishes this week, with the tally written next to it. That gives the concept of accumulating and rewriting a value.</p>
  
  <p>A calendar on which you can only write or add stickers is a WORM (Write Once Read Many) device. Without getting into the acronym, it's a good way to discuss the idea of being able to change something vs being able to get a value from it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T08:39:19.040Z
Answers.LastActivityDate: 2018-01-27T03:03:10.410Z
Answers.LastEditDate: 2018-01-27T03:03:10.410Z
Answers.UserDisplayName: Andy Dent
Answers.Body: <p>I find the "box" aspect is far more important than the named aspect.  Maybe it's personal bias.  However, we can combine the two: it's a <em>named</em> box.  So you can say "Go look in the 'object color' box."</p>
  
  <p>If you're working with pure data (no objects), it may be effective to set up a white board, and mask off a few "boxes."  Each box gets a name like "number of chores done today."  Concepts like "Add 1 to the number of chores done today" start to become really meaningful that way!  And it just so happens that the word for these spaces on the whiteboard is "box," which is similar to the 3d boxes you might put objects in.</p>
  
  <p>Even better, it puts her in an excellent position to deal with the nuanced behavior of reference mechanics when she gets there.  If you're used to thinking of variables as spaces on a whiteboard, writing <em>references</em> to objects, like referencing the members of your family by name, is easier.  For many people, the jump to reference mechanics is a real struggle because they got used to the idea of "x is my bear, that's in a box on the shelf" rather than "x is a variable referencing my bear.  Y also references the same bear."  (I personally have struggled to help people with reference mechanics because it forces them to unlearn whatever models they used up to that point, and unlearning is hard)</p>
  
  <p>You can even use different color markers for references and data.  That starts to get them used to the idea that there is <em>some</em> fundamental difference between the word "dad" and a reference to Golo Roden.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T22:28:04.200Z
Answers.LastActivityDate: 2018-01-22T22:28:04.200Z
Answers.UserDisplayName: Cort Ammon
Answers.Body: <p>In Python, Java, or JavaScript, I talk about the type system as an ecosystem of different species of smart data.  Objects are self-aware chunks of memory to which you can send messages and which can do work for you.  I will frame this discussion in JavaScript.</p>
  
  <p>Example in Node</p>
  
  <pre><code>&gt; console.log("foo".length);
  3
  </code></pre>
  
  <p>As you know, it rapidly becomes tedious to do this with literals.  That's when we do this.</p>
  
  <pre><code>&gt; var x = "foo";
  &gt; x.length
  3
  </code></pre>
  
  <p>The variable is like a phone number. It gives you a means by which you can communicate with its object.  Assignment binds an object to a "phone number."  On a deeper level, a variable knows WHERE its object is in memory and knows how to find it.  Hey, that's like your phone. If you get on an airplane and fly to Des Moines, your mother can still dial the number and ring you even though you have moved.  The key idea: A variable knows how to find its object.  This is my initial explanation before  I get into complexities such as scope.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T01:20:51.927Z
Answers.LastActivityDate: 2018-01-22T01:20:51.927Z
Answers.UserDisplayName: ncmathsadist
Answers.Body: <p>This answer is probably a little more advanced than you're looking for, but it might help somebody else in the future, especially if they're working in a Java-like language.</p>
  
  <p>I really like this description: <a href="https://javaranch.com/campfire/StoryCups.jsp" rel="nofollow noreferrer">Cup Size -- a story about variables</a>.</p>
  
  <p>This describes variables as cups. You have different sized cups, which means they can hold different types of things. Each cup has a name written on it, so you can say "give me the thing in the large cup with a name of X".</p>
  
  <p>It then talks about the more advanced idea of references, which it describes as remote controls. A remote control goes in a cup, and points to a TV.</p>
  
  <p>It also has a follow-up article: <a href="https://javaranch.com/campfire/StoryPassBy.jsp" rel="nofollow noreferrer">Pass-by-Value Please</a>, which describes the fact that one TV can have multiple remote controls, each in a cup, and swapping out one of the remote controls for one that points to a different TV doesn't change the original TV. Like I said this is more advanced than you care about, but it really helped me understand the idea of pass-by-reference vs pass-by-value back when I was still figuring that stuff out.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T19:48:29.750Z
Answers.LastActivityDate: 2018-01-23T19:48:29.750Z
Answers.UserDisplayName: Kevin Workman
Answers.Body: <p>Well the question is of great importance because that of variable is arguably <em>the</em> most subtle but fundamental thing to learn, especially so at the reported young age. The subtlety remaining also for more mature people, so much that a great number of people using variables when programming are not so good in explaining what they are.</p>
  <p>There is really no computation without variables, as if you want any input to be taken care of, you will need a variable (except particularly crazy languages designed specifically for the task). And it's acceptable that a computation without input is not really a computation. Granted, technically you might want to compute many digits of <span class="math-container">$\tau = 2\pi$</span>, and you don't need any input for it (or do you?), but the example is quite clearly pathological, not representative of the normal situation that we want to teach for, and we can avoid entering this realm. <strong>A computer that always does the same thing becomes boring soon</strong>.</p>
  <p>So your points are really well thought out: a first explanation looking simple and wrong, and a second one looking correct but difficult. This is quite natural, being the concept <em>actually</em> difficult, it's not really possible to give a simple <em>and</em> correct explanation.</p>
  <p>The box analogy is not really so bad anyway, and it may be useful for understanding. The main obstacle in this case I would say is the &quot;why&quot; should one care about such boxes? I am afraid that this problem is in big part a fault of the tool: this is the main reason I don't like scratch as a beginner's tool. Yes it's nice and funny and interactive and everything, but it just lacks the most important of the concepts: that of variable/input. Or it makes it unnecessarily difficult to learn about the concept.</p>
  <p>I agree with what someone noted in the comments: when I was very young and learned about it, a variable was &quot;a name that can/will be substituted with some arbitrary value&quot;. It's also incredibly correct. It was so immediate for the young me that I remember wanting to put variables everywhere, without having a clue what I was doing, it was just <em>there where the magic happens</em>, and the magic was what interested me. For what attains to the <em>mechanism</em> of variables, this is it. There are some people who do not understand this, but I have a very hard time imagining what might be missing, being it so natural for me. I guess in the specific context of your daughter, she might be capable of understanding, given what she is already doing. For others, maybe boxes work.</p>
  <p>But the main point is still missing: <em>why</em> would we want to use variables?</p>
  <p>The effective way to learn here is usually not by some explanation, but by examples. Conceive problems and situations where variables are needed, show the idea once or twice and then experiment with novel situations. As already noted, this might not appear extremely natural in scratch. If you instead find one or more interesting ways of doing it in that environment, please let me know because I'm very curious.</p>
  <p>Of course, the name &quot;variable&quot; is also sometimes misleading if one is not careful: there is nothing varying, and any example situation that relies solely on changing values will fail to give a profound meaning.</p>
  <p>What must be conveyed instead is the necessity <strong>for the code to manage different situations in a homogeneous way</strong>, which is nothing more than the idea of wanting some input.</p>
  <p>For a much better structured pedagogical path in learning from absolute zero, playfully for young ages, forget scratch and see instead the great HTDP <a href="https://htdp.org/" rel="nofollow noreferrer">https://htdp.org/</a> .</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-09-25T14:20:54.123Z
Answers.LastActivityDate: 2024-09-25T14:20:54.123Z
Answers.UserDisplayName: user9137
Answers.Body: <p>I remembered an exercise for children in the Etoys-System I read about some time ago.  It does that not by explaining what a variable is but by introducing the need for variables.</p>
  
  <p>In the exercise children create a car in the Etoys-System (it's based on Squeak) that can drive around on the screen.  They also create a steering wheel which can be used to steer the car.</p>
  
  <p>This demostrates the need for variables because the facing of the wheel is connected to the facing of the car.  It connects two properties of the micro-world without specifying what the value of the properties is.</p>
  
  <p>You can find the paper with the exercise at <a href="http://vpri.org/pdf/rn2005001_learning.pdf" rel="nofollow noreferrer">http://vpri.org/pdf/rn2005001_learning.pdf</a> says it is a good way to teach about variables. The exercise is on page 2.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T14:24:39.977Z
Answers.LastActivityDate: 2018-01-22T14:24:39.977Z
Answers.UserDisplayName: Viktor Seifert
Answers.Body: <p>I'm not sure there's a "magic" explanation you can give her such that she will achieve "crystal clarity."  I think with most people, and especially with kids, you need to demonstrate this and then "let it sink in."  One of the first programs I wrote (guided by my then much older IBM 370 systems programmer brother-in-law) specifically to learn what variables are and how they are used computed Fibonacci numbers.  I think we used Fortran back then.  You get the idea though.... you have a 3 variables, sum, num1 and num2.  You know the rest...  Get your daughter to write a program that does that.  Even help her write it.  A lot.  Just involve her in the writing and show her how it dumps out:0, 1, 1, 2, 3, 5, 8, ...</p>
  
  <p>It will sink in.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T21:42:15.350Z
Answers.Text: Not many explanations are "magic" for any student of any age. An explanation should be more of a "conversation" than an "answer" so that the learner can reveal what they still don't get and the teacher can refine the explanation, filling in the needed bits until the A-Ha experience. This is why "The Perfect Lecture" is an oxymoron.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-21T20:09:46.943Z
Answers.LastActivityDate: 2018-01-21T20:09:46.943Z
Answers.UserDisplayName: mbmast
Answers.Body: <p>Has she done basic algebra?  "A white box has three marbles in it, and a blue box has four marbles in it.  If I have six white boxes and five blue boxes, how many marbles have I got?"  Is her maths up to this level yet?  At age 9, I'd hope so.</p>
  
  <p>You can also make life easier by calling the variables something meaningful, which is good programming practise anyway.  So your variables would be "number_of_marbles_in_a_white_box", "number_of_marbles_in_a_blue_box", "number_of_white_boxes", "number_of_blue_boxes", and "number_of_marbles".  Restrain your natural tendency to use shorter names.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-19T20:04:33.553Z
Answers.Text: This answer would be probably better suitable as a comment to the question.
Answers.UserDisplayName: Maciej Łoziński
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T15:02:07.283Z
Answers.LastActivityDate: 2018-01-23T15:02:07.283Z
Answers.UserDisplayName: Graham
Answers.Body: <p>The issue is that a variable is not just one thing -- it can do a variety of things -- and also, that <em>variables do not exist in nature</em>. Nothing else in a person's experience behaves in all of the ways that a variable can. So, you need a ramp that begins simply and describes the various variations of variables.</p>
  
  <p>Early computers did not have any programming, they were circuits connected by cables. If you wanted a push-button to affect the computer, you used a wire to connect the push-button to a circuit. When Binary Coding came along, you could get the input from the button by reading a value from a numbered memory address. Assembly language allowed you to give that address a name. You could call it ButtonValue or something, and just test it with an IF statement. But you could also define another variable, like Input1, and put the value in there, along with some other input values and then feed that to some code you wrote. Now we have the idea of named locations, and assignment. Good, but not nearly far enough.</p>
  
  <p>A collection of similar variables can be put together in an Array, and then a variable used to index through the array. Any child should understand that, because they have all stood in line and called out numbers one by one. Finally, there is the idea of indirection, that a variable can decide which variable to refer to. I could have a variable called Greeting, and based on the current time, put one of three other variables in it, holding values like: "Good morning", "Good afternoon" and "Good Evening". Add a variable for the student's name and this program will be able to greet anyone at any time. We used variables so that the strings (Good Morning, etc) can be easily changed, possibly at the direction of a variable called Language...</p>
  
  <p>Nothing else in the world works that way, but with these simple examples, it should be clear to any nine year old. The problem then will be keeping them off the computer. I spent a lot of hours writing programs to output geometric figures in text on a PDP-11 terminal.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T16:10:39.760Z
Answers.Text: Welcome to [cseducators.se]! Your answer seems to be tying together many concepts, which are just slightly related to variables. It wouldn't make it simpler for a 9 year old.
Answers.UserDisplayName: ItamarG3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T16:01:50.977Z
Answers.LastActivityDate: 2018-01-22T16:37:03.907Z
Answers.LastEditDate: 2018-01-22T16:37:03.907Z
Answers.UserDisplayName: user4069
Answers.Body: <p>For a nine year old, you can say that a variable is a "change item", such as weather in the environment. 
  On the other hand, if it proves too challenging to explain it, you can kindly postpone this subject until she is old enough to appreciate it. Bear in mind that kids at this age are not very good in abstract thinking. Try again when she is about 12-13.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T08:16:53.690Z
Answers.Text: No kids are fin at abstract reasoning, and theres evidence in the literature that confirms that (Think about it: Kids learn to speak ex-nihilo other than some rudimentary wetware to jumpstart grammar learning). The trick is to just not use jargon to explain jargon. "A box to put a number or sentence in" works fine.
Answers.UserDisplayName: Shayne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T13:21:09.870Z
Answers.Text: There is plenty of evidence to suggest that kids are not good at abstract reasoning. "Developmental psychologist Jean Piaget argued that children develop abstract reasoning skills as part of their last stage of development, known as the formal operational stage." This seems related https://www.sciencedirect.com/science/article/pii/S1878929314000516 and excerpt taken from https://www.goodtherapy.org/blog/psychpedia/abstract-thinking
Answers.UserDisplayName: TryHarder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T05:49:43.020Z
Answers.LastActivityDate: 2018-01-22T05:49:43.020Z
Answers.UserDisplayName: TheMaverick
Answers.Body: <p>First explain the kid meaning of variable as something that keeps changing (like weather). Then he will get idea about the word and then tell him, in CS how we assign a value to the variable and how we are able to change it afterwords</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T12:57:26.103Z
Answers.Text: Can you elaborate on *how* you'd explain it? I'm not sure what you mean by "as something that keeps changing"
Answers.UserDisplayName: thesecretmaster
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T02:52:49.720Z
Answers.LastActivityDate: 2018-01-22T02:52:49.720Z
Answers.UserDisplayName: Yogeshwar Shendye
Answers.Body: <p>I would use integer math. On a sheet of paper, set up a small arithmetic table with three columns marked X, Y and 10. Include a '+' between X &amp; Y and an '=' between Y &amp; 10. Fill in 10 down the rows, and start by plugging figures into the X &amp; Y. So, row 1 will have 1 for X and 9 for Y, row 2 will have 2 for X and 8 for Y etc. </p>
  
  <p>Have your daughter fill in the information for the rest of the rows and then point out that X and Y are the variables - because their values can <em>vary</em> - and can have a range of answers that are all correct.</p>
  
  <p>This will not only point out the variable concept, but also help out when they throw algebra at her at school in a few years.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T14:53:52.203Z
Answers.LastActivityDate: 2018-01-22T14:53:52.203Z
Answers.UserDisplayName: mcalex
Answers.Body: <p>My usual explanation is related to names; specifically names of people. People have names. The names <em>are not</em> the people, but can be used to refer to the people. </p>
  
  <p>Some people don't have any names at all. This is common just after birth at least, before the parents decide on a name. </p>
  
  <p>Names can be changed. A person can have a name for a while and then later have a different name. So, <strong>different names can refer to the same person.</strong> Similarly we have come to rely on names known to only a few other people. A father might refer to his son as <em>junior</em> even if their names are not the same. Spouses often call each other <em>honey</em> without confusion. </p>
  
  <p>Just as important, a name isn't necessarily permanently bound to a thing (person, value, object). A name like <em>Sue</em> could refer to one person in a given household, but a different person elsewhere. Also, a name like "kiddo" could refer to one child at a given moment, but to a different child, even in the same household, at a slightly later moment. </p>
  
  <hr>
  
  <p>Different names can refer to the same "object" at the same time. Different variables can reference the same thing at the same time. </p>
  
  <p>A given name can refer to different objects, but not simultaneously. 
  A variable can refer to one thing one moment but another at a different moment. </p>
  
  <p>A given name can refer to a given object in one "place" but a different object in a different place.</p>
  
  <p>Here "object" just means a value of some kind, not necessarily an object in an OO language. It could even refer to an operation, depending on the language.  </p>
  
  <hr>
  
  <p>A variable, like a name, is an association between a word (more technically a symbol) and a value. Assignments in many languages establish the association. The association is valid in a place (scope) and for a time (duration). </p>
  
  <hr>
  
  <p>However, if your daughter has been studying algebra, you will need to make clear that what a mathematician calls a variable is quite different from what a computer scientist does. </p>
  
  <p>In CS, a variable can actually vary, so the term is much closer to the truth. In math, especially algebra, the word variable is often used for an "as yet to be determined" but definite value (or set of values). It doesn't actually vary. Mathematicians also call them "unknowns", but that just means "not <em>yet</em> known until we solve this thing" but still, a definite value. In CS, variables have definite but changeable values. They are never "unknown" to the computer, but may be to the programmer who isn't actually tracing the program. </p>
  
  <hr>
  
  <p>A note on "sameness". </p>
  
  <p>When we say $x = 3; y = 3;$ we don't imply that there are two threes. </p>
  
  <p>When we say $x = 3; ... x = 4;$ we don't imply that three has somehow become four. </p>
  
  <p>In the first we simply mean that we have two distinct references (names) for 3 and in the second we mean that the (old) reference to 3 is now a reference to something else. </p>
  
  <p>While every experienced programmer understands this, it can become a bottleneck for a novice. Three is three. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-21T22:47:10.887Z
Answers.Text: I would not introduce the concept of sameness (object identity) of persons at the same time. Every variable has its own value and can change on its own, it is not necessarily an object reference. Also I think we can (and should) introduce variables without the concept of scopes (the same name used to label different variables in different contexts).
Answers.UserDisplayName: Bergi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T02:25:20.593Z
Answers.Text: With my wife, I have been using the names of *animals*. Obviously, my wife is not a child, but a quite intelligent woman, but her background in mathematics and statistics makes some aspects of variables in programming counter-intuitive for her, and this analogy has helped. I emphasize the name being of an animal (specifically, a turtle, since we’re practicing with a Logo-style turtle module) because *animals for the most part don’t know anything about the names we assign to them.* This helps emphasize that an object exists independently of names, and can have multiple names refer to it.
Answers.UserDisplayName: KRyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T02:28:09.293Z
Answers.Text: It helps her remember that the turtle we called `louis`, and then passed into a function, is the same turtle that function just calls `turtle`, and that the turtle itself doesn’t really care what you call it.
Answers.UserDisplayName: KRyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T11:09:34.343Z
Answers.Text: Not that I agree with this necessarily but I would point out another point of view. When training as a teacher we were told that it was not necessarily best to advance a child's education like this. For your daughter, she will probably be able to understand this but in future years she will have to relearn this at school and may become disinterested or disenfranchised entirely. I respect your drive to teach your daughter and I'm sure she is enjoying it but I would bare in mind that in a few years, this may not have been what was best for her.
Answers.UserDisplayName: Leonhard Euler
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T20:49:17.807Z
Answers.Text: @stuartstevenson While I note that you said you don't necessarily agree with that philosophy, the idea of delaying the introduction of a concept usually taught at a later age *horrifies* me. The answer is *never* to restrict an interested student, but to get them different / better instruction if they've moved beyond the herd. Example: I moved from a city to a rural town in 6th grade, and hardly learned anything for 4 years because there was no option but "here's what everyone else is doing this term". Yes, I was often bored, but few would argue that my previous teachers did me a disservice.
Answers.UserDisplayName: brichins
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T16:34:59.303Z
Answers.Text: Names are references, not variables. Yes, in some modern languages, most or all variables contain references, but this is not the same, and it is a subtly or not-so-subtly different concept which would likely make things more difficult for the child... for example, humans usually never change their name; you have the "identity" stuff muddling stuff, etc.
Answers.UserDisplayName: AnoE
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T16:54:40.550Z
Answers.Text: “In CS, a variable can actually vary” – I'd rather say in _imperative programming_, a variable can actually vary. CS per se doesn't need that.
Answers.UserDisplayName: leftaroundabout
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T16:20:49.237Z
Answers.Text: @stuartstevenson bored and disenfranchised now, or bored and disenfranchised later? I had this problem all through my childhood, the older I got the better I was able to self motivate. My kids have it much better, each school they have been in so far has had programs that try to tailor to the kids level. Early on I honestly feared that when when they moved on to middle school/high school the same sorts of programs wouldn't exist and being forced into a more traditional classroom would be too hard to adjust to. Seems my worry was for naught. (well until college.)
Answers.UserDisplayName: Mr.Mindor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T17:48:18.143Z
Answers.Text: I disagree with the bit about variables in mathematics not varying - if you have: x = 2y, you can draw a graph that shows how x and y vary in conjunction with one another.
Answers.UserDisplayName: Mr_Thyroid
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T17:56:43.963Z
Answers.Text: Actually, such a statement just defines a relationship between two values. There is nothing necessarily implied about _varying_ in it. It is _you_ that varies the values, meaning mostly that you decide to explore several (or all) pairs in the relationship. A variable in, say Java, is quite a different thing.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-21T17:28:11.540Z
Answers.LastActivityDate: 2018-01-22T14:09:48.390Z
Answers.LastEditDate: 2018-01-22T14:09:48.390Z
Answers.UserDisplayName: Buffy
Answers.Body: <p><a href="https://cseducators.stackexchange.com/a/4199/1091">Buffy's lovely answer</a> shows well how two variables can refer to the same thing, but since we are in early cognitive development and working with Scratch, in which you can't pass parameters, and can't arrange for two different names to refer to the same instance/spawn, I wouldn't focus my efforts on that point yet.  What matters is the idea of a holding place and mutability.</p>
  <p>These concepts are hard to describe in a way that a 9-year-old would already know how to mentally model, but one very similar idea with which they are already familiar is the idea of a &quot;role&quot;.</p>
  <p>The <em>President of the United States</em> is currently Joe Biden.  (You should substitute the head executive leader of whatever country your child lives in for this example.)  But a few years ago, it was Donald Trump.  Later, it could be Donald Trump again, or someone else entirely.  When important things need to go to the president, they go to whoever is the president <em>right now</em>.  They don't go to Donald Trump any more, and some day, they will no longer go to Joe Biden.  But they always go to the President.</p>
  <p>So, to put this into Scratch, we can make a String in scratch called <code>President</code>, and then we can use the <code>set</code> box to <code>set President to &quot;Joe Biden&quot;</code>.  We can then make an item in the main field that behaves as a button, that changes that variable to <em><code>[insert your child's name here]</code></em>.</p>
  <p>Now, we can create another value, called <code>x</code>, and set that to a zero.  Now, when you press the button, <code>change x by 4</code>, and we can watch the variables change.  Press the button 10 times, and the value becomes <code>40</code>.</p>
  <p>So, what can we say about <code>x</code>?  Sometimes we say that <code>x</code> is 40, but is it really?  Or does it just <em>hold</em> 40?</p>
  <p>This is the most important <em>early understanding</em> to arrive at when describing a variable.  When we say that <code>x</code> is 40, what we really mean is that <code>x</code> <em>holds</em> 40.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T17:21:16.650Z
Answers.Text: IMHO this is the best answer, since it explicitly addresses a way of thinking that is suited for a 9 year old child. Hence accepted :-)
Answers.UserDisplayName: Golo Roden
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T19:41:54.497Z
Answers.Text: Most of the other answers are technically correct but focus too much on details that are not relevant to a 9-year-old beginner programming level. The names analogy is great for when you start talking about references though. But I think that variables are conceptually different from references, so the box analogy is far less confusing.
Answers.UserDisplayName: Beefster
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T21:05:47.030Z
Answers.Text: "Role" is fairly abstract ...I think it's the White House (or rather the Oval Office, but that's perhaps not known to a 9 year old) which contains the current president: ["And finally, be sure to include the full address of the White House to make sure your message gets to us as quickly and directly as possible:
  
  The White House
  1600 Pennsylvania Avenue NW
  Washington, DC 20500"](https://www.whitehouse.gov/get-involved/write-or-call/)
Answers.UserDisplayName: Peter - Reinstate Monica
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T22:02:45.623Z
Answers.Text: This got protected, so I can't create an answer. I think `my_age` a the perfect variable that any 9 year old can immediately grasp.  It's also a good lead in to classes later `me.age` `you.age` `class person {int age}`
Answers.UserDisplayName: gunfulker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T18:59:02.887Z
Answers.Text: Terrific answer. This also transitions well to the concept of pointers. Who is the president of the senate? You could *reference* the role of the vice president, or you could use the *name* (value) of the vice president. Both are correct now, but only one will still be correct a decade from now.
Answers.UserDisplayName: Chuck
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T19:38:03.057Z
Answers.Text: President? Surely "teacher" is an easier concept for a child to grasp? At that age, don't they get a new one every year, juts as presidents change in your example? Or, if they have one teacher per subject, explain how the current teacher variable value changes as the subject, or classroom changes? This might all vary by country but I think that school related concepts are easier to grasp than abstract concepts like "leader" of a "country" - whatever that is when you are 9
Answers.UserDisplayName: Mawg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T19:36:54.397Z
Answers.Text: @Mawg That a 9-year-old could easily have multiple teachers muddies the waters, so to "localize" things, you could go with "Principal", of which there is only one in the entire school at any given time.  When I was 9, I knew that Lyndon Johnson was President.  (I was just a tad too young to know *why* he'd gotten the job in the first place, which happened when I was 2.)
Answers.UserDisplayName: Monty Harder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T20:57:12.793Z
Answers.Text: Your last sentence, put another way:  When we say that `x` is 40, what we really mean is that `x` is 40 ***right now***.
Answers.UserDisplayName: J.R.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T03:06:38.470Z
Answers.Text: There are a few comments as to a better subject to convey mutability (leaders, teachers), but if something more immediate is warranted, I think you could do well with `day` - if you work on the program every day, this var will be different until the end of the week, when it becomes something it was already.  `Day` also leads to `hour`, `minute` and `second`, which means that you'll be writing a clock in no time.
Answers.UserDisplayName: n_b
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T18:03:45.307Z
Answers.Text: @gunfulker Yes! - so many confusing answers - just work through some simple examples with variables such as: currentYear, birthYear, age. 
   Then expand it with: legalDrivingAge, yearLearnDriving, etc, etc.
Answers.UserDisplayName: Mr_Thyroid
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T22:08:08.477Z
Answers.Text: +1 I struggled a lot with this in particular trying to engage my 10 year old niece. This is a great way of thinking about it, and is now going to be my go-to. Using 'teacher' as the variable word works too, in the sense of "Who is your 'teacher'? My 'teacher' is ____." I feel she'd grasp the concept that 'teacher' is something that can change, even though 'teacher' holds someone's name to it
Answers.UserDisplayName: psosuna
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-28T19:29:42.137Z
Answers.Text: @Chuck there are some things that should be kept away from a 9-yo child and pointers might be one of them. Of course after guns, drugs, violent TV/fiction... and C++.
Answers.UserDisplayName: Andrea Lazzarotto
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-29T04:10:38.507Z
Answers.Text: The first time my coding club members encountered variables is with the the player's score. It's so intuitive it barely needs explanation. Honestly I think there's a whole heap of over thinking going on here in the question and answers.
Answers.UserDisplayName: Jim W
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-01-22T14:01:03.363Z
Answers.LastActivityDate: 2022-11-16T19:55:05.880Z
Answers.LastEditDate: 2022-11-16T19:55:05.880Z
Answers.UserDisplayName: Ben I.
Answers.Body: <p>Memory is a linear sequence of storage locations.</p>
  
  <p>Like a lined sheet of paper.</p>
  
  <p>Take a lined sheet of paper and choose a line.</p>
  
  <p>In the left margin, write a label.</p>
  
  <p>The variable is that label - it gives a name to a spot.</p>
  
  <p>Now look for the label and write something to the right of the margin.</p>
  
  <p>That is assignment.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T01:06:21.983Z
Answers.LastActivityDate: 2018-01-22T01:23:40.540Z
Answers.LastEditDate: 2018-01-22T01:23:40.540Z
Answers.UserDisplayName: user1692597
Answers.Body: <p>What about this?</p>
  <blockquote>
  <p>You have a lot of values that you need to remember, so you put a label on each one (a little piece of paper to remind you what this value means) so you can find the value easily when you need it.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T08:11:17.973Z
Answers.Text: A good variation of this, is that its a box with a number or sentence in it, and each box has a label saying whats in it. Then you can use the metaphor to ask further questions. "The Box X has some oranges in it, and 2 oranges in your hand. If you know there are 10 oranges all together, how many oranges in box X ? (  X + 2 = 10 )
Answers.UserDisplayName: Shayne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T11:50:52.383Z
Answers.Text: @Shayne Scratch is an object oriented system, so there are objects (including values such as string and numbers), and there are variables which have names and refer to objects. You would have to unlearn the box metaphor once you try to put the same object into two boxes. This causes constant confusion in Java where references to objects are passed by value, so people get taught that 'primitive' variables act like boxes and 'reference' variables are different, despite the physical behaviour being identical.
Answers.UserDisplayName: Pete Kirkham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T11:18:28.827Z
Answers.Text: @PeteKirkham have a box labeled A with an orange in it. have two more boxes, labeled B and C, and put a note reading "A" into each. two notes, one orange.
Answers.UserDisplayName: Will Ness
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T08:37:57.183Z
Answers.Text: That would correspond to a different case, such as in C++ where you can have `a` as a pointer and `b` and `c` references to `a` (putting an apple in `a` would cause `b` and `c` to refer to the apple, not the original orange)
Answers.UserDisplayName: Pete Kirkham
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-01-21T17:04:16.257Z
Answers.LastActivityDate: 2024-09-09T12:09:38.687Z
Answers.LastEditDate: 2024-09-09T12:09:38.687Z
Answers.UserDisplayName: DPDP
Answers.Body: <p>The variable that children are most familiar with is <em>score</em>: whether in computer games, sports or board games, a child will almost certainly understand that a <em>score</em> is a value that is clearly not constant.</p>
  
  <p>Variables are abstract, but using familiar examples turns this into something easy to grasp.</p>
  
  <p>Once numeric variables are understood, you can extend the metaphor to cover string variables in a related example, e.g. the <em>word to guess</em> or the <em>player's name</em>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-30T18:37:44.797Z
Answers.Text: Score is arguably the best way to teach a kid about a variable. In fact, the "score" is a variable you use every day, all the time. Watch a basketball game, and ask what the Celtic's score is repeatedly throughout the game, the score changes, but it's still the score. It's a number, it changes, people talk about "the score", it's shown on the screen, etc. Perfect example. Much less nebulous than "a box" that has a number in it. My second example would be "Mad Libs".
Answers.UserDisplayName: Gorchestopher H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T14:40:55.563Z
Answers.LastActivityDate: 2018-01-22T14:50:00.637Z
Answers.LastEditDate: 2018-01-22T14:50:00.637Z
Answers.UserDisplayName: pbeentje
Answers.Body: <p>If I remember correctly, Scratch has two kinds of variables - object-bound and global. When teaching my son about Scratch, at the time of introducing variables I told him he had been working with object variables/properties the whole time: the <em>position</em> <code>x</code> and <code>y</code> (and to a lesser extent the object sprite/appearance (not sure what it is called in the English version of Scratch)).</p>
  
  <p>From there it was easy to introduce more (custom) variables as more properties of the corresponding character - whether the monster is alive or not, how much energy it has, etc.</p>
  
  <p>The general concept of variable (not bound to a specific object) can follow later: instead of "something we know about an object", talk of "something we know".</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-21T19:46:17.127Z
Answers.LastActivityDate: 2018-01-24T02:46:07.833Z
Answers.LastEditDate: 2018-01-24T02:46:07.833Z
Answers.UserDisplayName: tendays
Answers.Body: <p>It might be a bit indirect but around that age I bootstrapped myself from fill in the blank math problems through basic algebra to more generalized variable use.</p>
  
  <p>eg I started with having been given problems like:  </p>
  
  <blockquote>
    <p>5 + __ = 9, what number goes in the blank?</p>
  </blockquote>
  
  <p>From there naming the blank to get to basic algebra problem:</p>
  
  <blockquote>
    <p>5 + X = 9, solve for X.</p>
  </blockquote>
  
  <p>From there a programming variable just lets you use the same place holder repeatedly.  (While the same is true of variables in math systems of equations, etc are probably a bit too advanced for the average 9 year old.)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T19:22:07.540Z
Answers.Text: A variable in algebra is quite unlike a variable in computing. In your fill in the blanks, only one value will be "correct". It can't vary. This will become extremely confusing later and is often a stumbling block for new programmers who know algebra already.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T19:55:10.057Z
Answers.Text: @Buffy it never was for me.  ¯\\_(ツ)_/¯  It was long enough ago that I don't recall if I was aware of graphing functions where variables did vary within a single expression, saw a programming variable changing as equivalent to `x` having different values in each problem in a set of questions, or something else.
Answers.UserDisplayName: Dan Is Fiddling By Firelight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T00:09:14.410Z
Answers.Text: @Buffy I disagree that it's confusing. X can be anything in Dan's example. Only one value actually makes it true. I think that's kind of the entire point.
Answers.UserDisplayName: corsiKa
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T02:41:16.423Z
Answers.Text: Op's kid is "heavily interested in science, robots, computers". Shouldn't they start at the beginning and learn algebra? (+1) IME learning equations that solve for X was easy. It's expressions that I don't like, because there's no solution when there's more than one variable. If they understand mathematical expressions, wouldn't they understand variables in computing? AFAIK, you definitely need to understand what X means in an equation before you even touch expressions.
Answers.UserDisplayName: Mazura
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-21T18:31:24.943Z
Answers.LastActivityDate: 2018-01-21T18:31:24.943Z
Answers.UserDisplayName: Dan Is Fiddling By Firelight
Answers.Body: <p>I just saw <a href="https://cseducators.stackexchange.com/a/4199/4036">Buffy's answer</a> so all credits to @Buffy and though I could simplify it with one word in a way that 9 year old me would have understood.</p>
  
  <p><em>(Although bear in mind I was also mucking around with Visual Basic 6 at 9 years old so this could also be very inaccurate &amp; harder to grasp)</em></p>
  
  <p><strong>A nickname.</strong></p>
  
  <pre><code>x = "the name of the program in scratch";
  </code></pre>
  
  <p>x is the nickname of what you're making in scratch</p>
  
  <p>A way to implement this (not sure if possible in Scratch as I've never used it):
  Make X the title of the application/game/program and tell her to change the program's nickname (x) and then the programs full name/first name.</p>
  
  <p>It might also help to explain the possibility of errors (if any are possible), example being, rename the x variable where it's defined, but not referenced, then watch the errors pop up for unknown variable 'x' because you "changed the 'nickname' without telling anyone"</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T05:47:39.467Z
Answers.Text: Thank you everyone for your up votes, I'm still dumbfounded that I managed to get enough reputation to comment in this community from one comment overnight. Thanks again guys, hope my answer help(ed/s) :)
Answers.UserDisplayName: brandito
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T05:53:03.120Z
Answers.LastActivityDate: 2018-01-23T05:20:43.563Z
Answers.LastEditDate: 2018-01-23T05:20:43.563Z
Answers.UserDisplayName: brandito
Answers.Body: <p>On Steam is the game <a href="http://store.steampowered.com/app/375820/Human_Resource_Machine/" rel="nofollow noreferrer">Human Resource Machine</a>.  While it is a game it is played using simple programming commands as blocks like Scratch, has an input and output conveyor and several places to hold intermediate calculations or values, think variables. Latter in the game you can even name the locations.</p>
  
  <p>While some of the problems are too hard for someone 9 years old, the upside of the game is that it gives you a visual representation to the abstract concept of a variable. It also has a character that moves the boxes around and performs simple operations such as add based on the commands. </p>
  
  <p>As such when I read your question what I see as the true question is how do I get a 9 year old to understand a variable as an abstract concept. The game gives helps in that it gives the player a concrete and visual representation of a variable as something concrete being interacted with the game character. Once the player understands what a variable is, they can abstract that away in the way professional programmers do with many concepts.</p>
  
  <p>Also I would not consider a variable as the first abstract concept a child learns but the concept of words and numbers. The words are typically one word to one concrete item. A number is one value to a count of concrete items. A number can also be a way to give a unique name to group of similar items. A variable in one of its simplest is one word to one item that has similar properties or relationships but that can be replaced as time progresses.</p>
  
  <p>When I introduce variables I state that a variable has a name but in some languages also has a type. So in teaching variables it can help to also introduce the concept of type.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T18:43:52.043Z
Answers.Text: Actually, you get in trouble with the Python and Ruby people saying a variable (name) has a type. It isn't that the type is dynamic, it is that only the value to which it then refers has a type. Any name can refer to any value, but a value has an unchangeable type.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T14:37:36.067Z
Answers.Text: For future reference, the difference between static and dynamic typing. In some languages (Java...) type checking is done prior to execution (statically), usually by the compiler, but possibly by another tool. In other languages (Python...) that isn't possible in general, so typing is done at run time (dynamically). Statically typed languages are necessarily more verbose than a similar dynamically typed one as more type information usually needs to be included by the programmer. There are exceptions. Standard ML, for example, can statically type most programs without any type notations. Cool.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T11:49:34.513Z
Answers.Text: Python is "dynamic" but "strongly-typed" so you can't add 4 + "fred". JavaScript is "dynamic" and "weakly-typed" so converts types in expressions and causes endless confusion.
Answers.UserDisplayName: Andy Dent
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T11:07:35.777Z
Answers.LastActivityDate: 2018-01-23T14:02:34.727Z
Answers.LastEditDate: 2018-01-23T14:02:34.727Z
Answers.UserDisplayName: Guy Coder
Answers.Body: <p>The box analogy seems good to me. If you want to continue the programming "language" analogy, variables are pronouns. In English, we rely on people using context to figure out what a pronoun refers to, but in programming we explicitly tell the computer what the pronoun refers to. You could have variable names like "it", "that", "the_thing", "the_other_thing" to reinforce that.</p>
  
  <p>Something else to consider is to ask her how to do something. "Play dumb", so she has to be <em>really</em> explicit. If you choose the task well, she will repeatedly say things like "Take the thing that you got in step 4 and ..." This will then lead to the concept of "What if we could just use some short name, instead of having to say 'the thing you got in step 4' each time?"</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T08:14:12.603Z
Answers.Text: When I learn programming as a kid on the C64, the book I used , used the 'a variable is a box with a name like X or $Y that you put things in to remember'. I understood it instantly. Its a good metaphor
Answers.UserDisplayName: Shayne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T10:08:23.887Z
Answers.Text: +1 I also like the use of a box as a variable stand-in. It lends it's self to further analogy.  All variables (boxes) have a type (maybe colour code them).  They need to be declared (added to the program), and then they can hold anything that fits that type of box. So you can put characters, words and sentences in a red 'String' box. You can put numbers in your blue 'Integer' box, and you can put either in your purple 'Variant' box. You can explain arrays with a box of boxes, collections and lists with boxes that are just grouped together, and constants with locked boxes and so on and so on.
Answers.UserDisplayName: Brent Hackers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T00:52:57.203Z
Answers.LastActivityDate: 2018-01-22T00:52:57.203Z
Answers.UserDisplayName: Acccumulation
Answers.Body: <p>I like to explain it as a placeholder. So that I don't have to read and write so much.</p>
  <blockquote>
  <p>I have a friend named John Jacob Jingleheimer Schmidt. His name, John Jacob Jingleheimer Schmidt, is my name too. Whenever I go out with John Jacob Jingleheimer Schmidt, the people always shout. There goes John Jacob Jingleheimer Schmidt. John Jacob Jingleheimer Schmidt is my best friend. John Jacob Jingleheimer Schmidt likes to go down the slide at the park. John Jacob Jingleheimer Schmidt has brown hair.</p>
  </blockquote>
  <p>Or I could just write at the top of the paper</p>
  <blockquote>
  <p>JohnsName = John Jacob Jingleheimer Schmidt</p>
  <p>I have a friend named JohnsName. His name, JohnsName, is my name too. Whenever I go out with JohnsName, the people always shout. There goes JohnsName. JohnsName is my best friend. JohnsName likes to go down the slide at the park. JohnsName has brown hair.</p>
  </blockquote>
  <p>This often prompts &quot;Can't I just say John instead?&quot; and I tell them &quot;Yep, we could even just say &quot;J = John Jacob Jingleheimer Schmidt&quot; and make it even shorter.&quot;</p>
  <p>&quot;Plus if John changes his name in the future we only have to change it at the top of the paper. &quot;</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T13:33:07.587Z
Answers.Text: I really like how this example shows abstraction in a fairly intuitive way, without having to directly define it
Answers.UserDisplayName: thanby
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T18:53:31.147Z
Answers.Text: Yes, but as a first cut the definition of abstraction is pretty simple: A simple name for a complex thing so that the name can be used instead of the complexity.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T17:28:43.157Z
Answers.LastActivityDate: 2018-01-25T18:50:19.240Z
Answers.LastEditDate: 2020-06-18T08:36:57.023Z
Answers.UserDisplayName: Jemmeh
Answers.Body: <p>Honestly all these analogies are extremely confusing. The box analogy was the best. I would just add to it.</p>
  
  <p>You have a box that has its entrance restricted like those block match toys for babies (to match shapes - for example they only take circles, or stars, etc). Some boxes only take stars (int), squares (string) etc. The box is small and only has enough space to fit one shape. </p>
  
  <p>But your box has certain properties. The bottom of the box has a one of these restricted opening to allow blocks to be pushed out the other side. So because the box is small, if you try to push another star into the box when there is already a star in there, it pushes the old one out and then only the new one is inside. This handles the idea of replacing values. And then of course types are explicit. If you try to put another shape into the box it wont fit.</p>
  
  <p>When you want to use the item you stored away in the box, you tell your program (assistant) to go fetch the box from the closet and bring it back to you so you can see what's inside. If you don't use the box as storage your program (assistant) is kind of forgetful (really old assistant) and may misplace the information.</p>
  
  <p>So this is why you store important things you want to remember inside the boxes.</p>
  
  <p>I think that covers all the bases. That is how I would explain variables.</p>
  
  <p>This seems like a very straightforward analogy. There is no abstraction which means even a kid can understand it in terms of real physical things. Children tend to have issues understanding abstraction, which is why algebra is generally left for when their brains are more developed. So this real world simple comparison should be understandable.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T19:20:30.560Z
Answers.Text: The box analogy has serious problems. Suppose I have 20,000 boxes? How do I find the one I want? The answer leads you deeper and deeper into harder to understand issues. Can I put the same shape into two different boxes? Is it really the "same" shape (value) then?
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T19:59:43.580Z
Answers.Text: There may be a better way to explain this, but I think this will cover all the bases at her level and have her still understand it.
Answers.UserDisplayName: Tyler S. Loeper
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T20:50:17.703Z
Answers.Text: I worry about explanations that don't smoothly extend to deeper explanations and that need to be "undone" before a student can move forward. I don't think the early explanation needs to be deep or complete, but it needs, at least, to be extensible. That is why I raise the issue of lots of boxes and several variables referring to the same value. If you explanation fails there, it just fails. Even a kid can raise those same questions and eventually a bright (or even random) one will. Never set up a situation in which you need to "unteach" anything to move forward.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T03:20:40.127Z
Answers.Text: @Buffy I don't see any problems with the box metapher. If we have multiple boxes, we label them to distinguish them - just like we do give names to variables. And if we have really many of them, we need to put some structure on it, be it scoped names or arrays (rows of boxes). Regarding "same shapes", that's where most physical analogies break down. But first we would need to define the terms "same" and "value" anyway. In fact, before introducing references/pointers/objects, we do have multiple distinct but *equal* values in the boxes indeed - and some magical cloning device.
Answers.UserDisplayName: Bergi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T15:58:27.453Z
Answers.LastActivityDate: 2018-01-22T19:15:55.473Z
Answers.LastEditDate: 2018-01-22T19:15:55.473Z
Answers.UserDisplayName: Tyler S. Loeper
Answers.Body: <p>There are a number of fine answers already here. This is how I thought of doing it, and it might provide another alternative that should be suitable for a 9 year old, and possibly younger. It should be something that gives a good visual image for the child to picture mentally.</p>
  <p>If I were speaking to the 9 year old:</p>
  <blockquote>
  <p>Say one day you decide you're really curious about the number of blue cars that pass your house on a typical day. That makes you think about the red cars, too, and the total number of cars.</p>
  <p>So, you get three cups - a blue one, a red one, and a clear one. Also you get a big stack of pennies. You sit on the porch all day. Every time a car goes by, you put a penny in the clear cup. If the car is blue, you also put a penny in the blue cup. If the car is red, you also put a penny in the red cup.</p>
  <p>At the end of the day, you count the number of pennies in the blue cup. That's the number of blue cars that went by. You do the same thing with the red cup, and that's the number of red cars that went by. Finally, you count the pennies in the clear cup, and that's the <em>total</em> number of cars that went by.</p>
  <p>The cups are variables, and each has a name - the blue cup is a variable named <em>blue-cars</em>, the red cup is named <em>red-cars</em>, and the clear cup is named <em>total-cars</em>. Each variable holds a number, the number of pennies in the cup.</p>
  <p>Oh, and by the way, you're the program. We can empty the cups and run you again tomorrow to count the cars.</p>
  <p>There are other things you can do, too. You can add the number of pennies from the blue cup and red cup, and see how many red and blue cars there were combined. If you want to get really fancy, you could count the number in the clear cup, then subtract the red cars and subtract the blue cars to see how many cars there were of other colors that you didn't count.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T13:27:59.533Z
Answers.Text: That's a decent visual explanation. I feel like it would be understandable to a young learner, even if they're not strong in the math department, because it's less abstract than simply trying to explain the concept of a variable. Personally I'd approach it with only the blue cup for starters, to keep it as simple as possible. Once they've got a basic understanding of that, then introduce other variables like the red or clear cups, or shift it to something other than numbers. Bonus points for the "You are the program" bit :)
Answers.UserDisplayName: thanby
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T22:12:44.550Z
Answers.LastActivityDate: 2018-01-24T22:18:03.670Z
Answers.LastEditDate: 2020-06-18T08:36:57.023Z
Answers.UserDisplayName: Don Branson
Answers.Body: <p>If this child plays Minecraft, you can try the following analogies:</p>
  
  <ul>
  <li>A variable is like a chest with a sign next to it. You can put stuff into a chest (assignment). This "stuff" in the chest is the value of the variable.</li>
  <li>A function is like a workbench, which transforms inputs (like wood) into the result (like wood planks in Minecraft).</li>
  </ul>
  
  <p>It is also helpful to explain to the child that the assignment operator (<code>=</code>) is better represented by an arrow (<code>&lt;-</code>).</p>
  
  <p>Then it becomes more logical:</p>
  
  <pre><code>var chest;
  
  chest = "some value"; // chest &lt;- "some value";
  </code></pre>
  
  <hr>
  
  <p>A completely different strategy would be to learn the assignment construct by heart. Of course, she should only learn the <strong>building blocks</strong> (e. g. the syntax and meaning of assignment to a variable) of programming by heart, NOT the solutions. You can add an <a href="https://apps.ankiweb.net/" rel="nofollow noreferrer">Anki</a> card with the following contents:</p>
  
  <p>Question: If you execute the statement</p>
  
  <pre><code>var chest = "bla";
  </code></pre>
  
  <p>what will chest contain thereafter?</p>
  
  <p>Answer: Text (string) "bla".</p>
  
  <hr>
  
  <p>Finally, repetition is your friend. My child started to understand these concepts after we've done several algorithm lessons on <a href="https://www.freecodecamp.org/" rel="nofollow noreferrer">FreeCodeCamp</a>. I cannot remember how often I repeated the concept of assignment to my child (always in a different programming problem) until he started to understand it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-24T11:33:56.730Z
Answers.Text: I kind of want the metaphor to involve putting the sign on a different chest. (first the sign meant one chest, then the sign meant a different chest, the chest can vary, this is called 'variable assignment' )
Answers.UserDisplayName: Pete Kirkham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-21T19:45:48.983Z
Answers.LastActivityDate: 2018-01-21T19:45:48.983Z
Answers.UserDisplayName: Glory to Russia
Body: <p>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 <a href="https://scratch.mit.edu/" rel="noreferrer">Scratch</a>, a programming language specifically designed for kids.</p>
  
  <p>She likes it a lot, and she enjoys getting visual results fast. Now we came to the point that you need a <em>variable</em>, 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 <em>variables</em> in mathematics yet (mind you, she is 9 years old).</p>
  
  <p>I remember that when <em>I</em> 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.</p>
  
  <p>Of course I can say:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>That's an analogy, and she understands it, but it's difficult for her to transfer this idea to Scratch code. It doesn't <em>feel</em> correct.</p>
  
  <p>If I say</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>So, how would you explain the concept of a variable to a 9 year old, in a way, that it is easy to grasp <em>AND</em> correct at the same time, i.e. it has a direct relation to writing code?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-21T22:50:34.630Z
Comments.Text: What does not feel correct about the box metapher? It's the closest to "variable = memory cell" we got. What other concepts (besides names) do Scratch variables use?
Comments.UserDisplayName: Bergi
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-22T13:01:03.537Z
Comments.Text: As the placeholder text says, "Use comments to ask for more information or suggest improvements. **Avoid answering questions in comments**" (emphasis mine). I've moved the comments [to chat](http://chat.stackexchange.com/rooms/72042/discussion-on-question-by-golo-roden-how-to-explain-the-concept-of-a-variable-to) because they have value, but further answers in the comment section will be removed and will not be moved to chat.
Comments.UserDisplayName: thesecretmaster
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-24T13:11:52.160Z
Comments.Text: @Bergi, you typically *don't* pass the box, unless you start talking about references or pointers (which I suspect is not what you want to start with). In such analogy you would *open* the box, and pass the content of the box as the result.
Comments.UserDisplayName: aioobe
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-24T14:28:41.093Z
Comments.Text: I can relate almost exactly to your daughter's predicament, because when I was her age my older brother was struggling to explain simple variables in algebra to me. The mutability of a variable is the thing I couldn't wrap my head around at the time. I feel like that's the key concept to communicate, but I'm still struggling with finding a way to explain it that my 9-year-old self would have understood. The accepted answer is definitely a good example, but I'm not totally convinced I would have picked it up. Hopefully your daughter is smarter than I was ;)
Comments.UserDisplayName: thanby
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-24T20:27:38.480Z
Comments.Text: @aioobe Well that's exactly what's happening in a function call as well. We don't pass a variable as an argument, we pass the value that the variable holds.
Comments.UserDisplayName: Bergi
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-25T03:39:21.393Z
Comments.Text: The box analogy seems confusing asf to me. I do not have a logical brain though, I am more of a creative.
Comments.UserDisplayName: ESR
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-25T06:46:09.340Z
Comments.Text: @Bergi, well, then I assume the question in your original comment ("What does not feel correct about the box metapher?") is answered :-) Also, note that not all languages have pass-by-value semantics. Pass-by-reference or mixes thereof is quite common.
Comments.UserDisplayName: aioobe
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-25T06:53:11.743Z
Comments.Text: @aioobe I'd say this is why the box analogy is perfect: it can express both notions
Comments.UserDisplayName: Bergi
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-25T10:44:34.767Z
Comments.Text: (I don't understand why my comment asking for more information was removed, so I'll try to rephrase it.) Why do you think you need to *explain the concept* of a variable? Playing around with examples might be more natural for a 9-year-old, understanding comes later.
Comments.UserDisplayName: JiK
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-25T13:19:44.500Z
Comments.Text: @JiK That's how I personally learn best, perhaps that qualifies as a full answer
Comments.UserDisplayName: thanby
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-26T19:00:56.400Z
Comments.Text: When I first came across algebra at age 10 the thing that confused me wasn't that X and Y could be names for abstract things; it was that I had done lots of puzzles in which X and Y represented digits in a number, so if X=2 and Y=3 then XY=23. No one explained to me that the things the letters stood for were quite different trom the things I thought they stood for, and that the notation XY wasn't decimal notation, it was multiplication. Very often in teaching, it's not getting the right idea instilled that's difficult, it's getting the wrong idea exorcised.
Comments.UserDisplayName: Michael Kay
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-28T19:25:36.673Z
Comments.Text: Can you clarify why you say "'it's not easy to grasp any more" regarding the second way? That's exactly what I was thinking when I started programming (at about 11) and it felt quite easy to grasp. Even easier than the more correct box analogy.
Comments.UserDisplayName: Andrea Lazzarotto
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-29T11:08:33.257Z
Comments.Text: Where I live, we have the concept of a "joker" in a deck of cards which can be treated as any card. Play some games with joker (or jack), then explain the concept through joker being a variable, able to take any value.
Comments.UserDisplayName: nurettin
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-15T19:20:40.533Z
Comments.Text: I've usually compared to a piece of paper for storing some information: You can keep writing what you know about it on a piece of paper or just change it. Different variables are like different pieces of paper/post-its. You just track stuff along. However, I've found it easier to teach this with "typed languages" than untyped ones - since it's confusing for a variable to be a string and int both in the context. But some find that easier...
Comments.UserDisplayName: PhD
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-22T22:45:35.633Z
Comments.Text: A variable *is* a box or scratch pad. It exists during program execution. Program texts contain variable names. What does "doesn't feel correct" mean?
Comments.UserDisplayName: philipxy
Tags: <lesson-ideas><variables><scratch>
Title: How to explain the concept of a variable to a 9-year old?
ThreadText: # How to explain the concept of a variable to a 9-year old?
  
  (Asked by: username_0 on 2018-01-21)
  
  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](https://scratch.mit.edu/), 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?
  
  **Tags:** lesson-ideas, variables, scratch
  
  > **Comments:**
  > **username_1**: What does not feel correct about the box metapher? It's the closest to "variable = memory cell" we got. What other concepts (besides names) do Scratch variables use?  
  > **username_2**: As the placeholder text says, "Use comments to ask for more information or suggest improvements. **Avoid answering questions in comments**" (emphasis mine). I've moved the comments [to chat](http://chat.stackexchange.com/rooms/72042/discussion-on-question-by-username_0-username_0-how-to-explain-the-concept-of-a-variable-to) because they have value, but further answers in the comment section username_50 be removed and username_50 not be moved to chat.  
  > **username_3**: @username_1, you typically *don't* pass the box, unless you start talking about references or pointers (which I suspect is not what you want to start with). In such analogy you would *open* the box, and pass the content of the box as the result.  
  > **username_4**: I can relate almost exactly to your daughter's predicament, because when I was her age my older brother was struggling to explain simple variables in algebra to me. The mutability of a variable is the thing I couldn't wrap my head around at the time. I feel like that's the key concept to communicate, but I'm still struggling with finding a way to explain it that my 9-year-old self would have understood. The accepted answer is definitely a good example, but I'm not totally convinced I would have picked it up. Hopefully your daughter is smarter than I was ;)  
  > **username_1**: @username_3 Well that's exactly what's happening in a function call as well. We don't pass a variable as an argument, we pass the value that the variable holds.  
  > **username_5**: The box analogy seems confusing asf to me. I do not have a logical brain though, I am more of a creative.  
  > **username_3**: @username_1, well, then I assume the question in your original comment ("What does not feel correct about the box metapher?") is answered :-) Also, note that not all languages have pass-by-value semantics. Pass-by-reference or mixes thereof is quite common.  
  > **username_1**: @username_3 I'd say this is why the box analogy is perfect: it can express both notions  
  > **username_6**: (I don't understand why my comment asking for more information was removed, so I'll try to rephrase it.) Why do you think you need to *explain the concept* of a variable? Playing around with examples might be more natural for a 9-year-old, understanding comes later.  
  > **username_4**: @username_6 That's how I personally learn best, perhaps that qualifies as a full answer  
  > **username_7**: When I first came across algebra at age 10 the thing that confused me wasn't that X and Y could be names for abstract things; it was that I had done lots of puzzles in which X and Y represented digits in a number, so if X=2 and Y=3 then XY=23. No one explained to me that the things the letters stood for were quite different trom the things I thought they stood for, and that the notation XY wasn't decimal notation, it was multiplication. Very often in teaching, it's not getting the right idea instilled that's difficult, it's getting the wrong idea exorcised.  
  > **username_8**: Can you clarify why you say "'it's not easy to grasp any more" regarding the second way? That's exactly what I was thinking when I started programming (at about 11) and it felt quite easy to grasp. Even easier than the more correct box analogy.  
  > **username_9**: Where I live, we have the concept of a "joker" in a deck of cards which can be treated as any card. Play some games with joker (or jack), then explain the concept through joker being a variable, able to take any value.  
  > **username_10**: I've usually compared to a piece of paper for storing some information: You can keep writing what you know about it on a piece of paper or just change it. Different variables are like different pieces of paper/post-its. You just track stuff along. However, I've found it easier to teach this with "typed languages" than untyped ones - since it's confusing for a variable to be a string and int both in the context. But some find that easier...  
  > **username_11**: A variable *is* a box or scratch pad. It exists during program execution. Program texts contain variable names. What does "doesn't feel correct" mean?  
  
  ---
  
  ## 26 answers
  
  ### Answer by username_36 on 2018-01-22. Score: 99 | Accepted answer
  
  [username_19's lovely answer](https://cseducators.stackexchange.com/a/4199/1091) shows well how two variables can refer to the same thing, but since we are in early cognitive development and working with Scratch, in which you can't pass parameters, and can't arrange for two different names to refer to the same instance/spawn, I wouldn't focus my efforts on that point yet. What matters is the idea of a holding place and mutability.
  
  These concepts are hard to describe in a way that a 9-year-old would already know how to mentally model, but one very similar idea with which they are already familiar is the idea of a "role".
  
  The *President of the United States* is currently Joe Biden. (You should substitute the head executive leader of whatever country your child lives in for this example.) But a few years ago, it was Donald Trump. Later, it could be Donald Trump again, or someone else entirely. When important things need to go to the president, they go to whoever is the president *right now*. They don't go to Donald Trump any more, and some day, they username_50 no longer go to Joe Biden. But they always go to the President.
  
  So, to put this into Scratch, we can make a String in scratch called `President`, and then we can use the `set` box to `set President to "Joe Biden"`. We can then make an item in the main field that behaves as a button, that changes that variable to *`[insert your child's name here]`*.
  
  Now, we can create another value, called `x`, and set that to a zero. Now, when you press the button, `change x by 4`, and we can watch the variables change. Press the button 10 times, and the value becomes `40`.
  
  So, what can we say about `x`? Sometimes we say that `x` is 40, but is it really? Or does it just *hold* 40?
  
  This is the most important *early understanding* to arrive at when describing a variable. When we say that `x` is 40, what we really mean is that `x` *holds* 40.
  
  > **Comments:**
  > **username_0**: IMHO this is the best answer, since it explicitly addresses a way of thinking that is suited for a 9 year old child. Hence accepted :-)  
  > **username_37**: Most of the other answers are technically correct but focus too much on details that are not relevant to a 9-year-old beginner programming level. The names analogy is great for when you start talking about references though. But I think that variables are conceptually different from references, so the box analogy is far less confusing.  
  > **username_38**: "Role" is fairly abstract ...I think it's the White House (or rather the Oval Office, but that's perhaps not known to a 9 year old) which contains the current president: ["And finally, be sure to include the full address of the White House to make sure your message gets to us as quickly and directly as possible:  The White House 1600 Pennsylvania Avenue NW Washington, DC 20500"](https://www.whitehouse.gov/get-involved/write-or-call/)  
  > **username_39**: This got protected, so I can't create an answer. I think `my_age` a the perfect variable that any 9 year old can immediately grasp.  It's also a good lead in to classes later `me.age` `you.age` `class person {int age}`  
  > **username_40**: Terrific answer. This also transitions well to the concept of pointers. Who is the president of the senate? You could *reference* the role of the vice president, or you could use the *name* (value) of the vice president. Both are correct now, but only one username_50 still be correct a decade from now.  
  > **username_41**: President? Surely "teacher" is an easier concept for a child to grasp? At that age, don't they get a new one every year, juts as presidents change in your example? Or, if they have one teacher per subject, explain how the current teacher variable value changes as the subject, or classroom changes? This might all vary by country but I think that school related concepts are easier to grasp than abstract concepts like "leader" of a "country" - whatever that is when you are 9  
  > **username_42**: @username_41 That a 9-year-old could easily have multiple teachers muddies the waters, so to "localize" things, you could go with "Principal", of which there is only one in the entire school at any given time.  When I was 9, I knew that Lyndon Johnson was President.  (I was just a tad too young to know *why* he'd gotten the job in the first place, which happened when I was 2.)  
  > **username_43**: Your last sentence, put another way:  When we say that `x` is 40, what we really mean is that `x` is 40 ***right now***.  
  > **username_44**: There are a few comments as to a better subject to convey mutability (leaders, teachers), but if something more immediate is warranted, I think you could do well with `day` - if you work on the program every day, this var username_50 be different until the end of the week, when it becomes something it was already.  `Day` also leads to `hour`, `minute` and `second`, which means that you'll be writing a clock in no time.  
  > **username_35**: @username_39 Yes! - so many confusing answers - just work through some simple examples with variables such as: currentYear, birthYear, age.   Then expand it with: legalDrivingAge, yearLearnDriving, etc, etc.  
  > **username_45**: +1 I struggled a lot with this in particular trying to engage my 10 year old niece. This is a great way of thinking about it, and is now going to be my go-to. Using 'teacher' as the variable word works too, in the sense of "Who is your 'teacher'? My 'teacher' is ____." I feel she'd grasp the concept that 'teacher' is something that can change, even though 'teacher' holds someone's name to it  
  > **username_8**: @username_40 there are some things that should be kept away from a 9-yo child and pointers might be one of them. Of course after guns, drugs, violent TV/fiction... and C++.  
  > **username_46**: The first time my coding club members encountered variables is with the the player's score. It's so intuitive it barely needs explanation. Honestly I think there's a whole heap of over thinking going on here in the question and answers.  
  
  ---
  
  ### Answer by username_19 on 2018-01-21. Score: 42
  
  My usual explanation is related to names; specifically names of people. People have names. The names *are not* the people, but can be used to refer to the people.
  
  Some people don't have any names at all. This is common just after birth at least, before the parents decide on a name.
  
  Names can be changed. A person can have a name for a while and then later have a different name. So, **different names can refer to the same person.** Similarly we have come to rely on names known to only a few other people. A father might refer to his son as *junior* even if their names are not the same. Spouses often call each other *honey* without confusion.
  
  Just as important, a name isn't necessarily permanently bound to a thing (person, value, object). A name like *Sue* could refer to one person in a given household, but a different person elsewhere. Also, a name like "kiddo" could refer to one child at a given moment, but to a different child, even in the same household, at a slightly later moment.
  
  ---
  
  Different names can refer to the same "object" at the same time. Different variables can reference the same thing at the same time.
  
  A given name can refer to different objects, but not simultaneously.
  A variable can refer to one thing one moment but another at a different moment.
  
  A given name can refer to a given object in one "place" but a different object in a different place.
  
  Here "object" just means a value of some kind, not necessarily an object in an OO language. It could even refer to an operation, depending on the language.
  
  ---
  
  A variable, like a name, is an association between a word (more technically a symbol) and a value. Assignments in many languages establish the association. The association is valid in a place (scope) and for a time (duration).
  
  ---
  
  However, if your daughter has been studying algebra, you username_50 need to make clear that what a mathematician calls a variable is quite different from what a computer scientist does.
  
  In CS, a variable can actually vary, so the term is much closer to the truth. In math, especially algebra, the word variable is often used for an "as yet to be determined" but definite value (or set of values). It doesn't actually vary. Mathematicians also call them "unknowns", but that just means "not *yet* known until we solve this thing" but still, a definite value. In CS, variables have definite but changeable values. They are never "unknown" to the computer, but may be to the programmer who isn't actually tracing the program.
  
  ---
  
  A note on "sameness".
  
  When we say $x = 3; y = 3;$ we don't imply that there are two threes.
  
  When we say $x = 3; ... x = 4;$ we don't imply that three has somehow become four.
  
  In the first we simply mean that we have two distinct references (names) for 3 and in the second we mean that the (old) reference to 3 is now a reference to something else.
  
  While every experienced programmer understands this, it can become a bottleneck for a novice. Three is three.
  
  > **Comments:**
  > **username_1**: I would not introduce the concept of sameness (object identity) of persons at the same time. Every variable has its own value and can change on its own, it is not necessarily an object reference. Also I think we can (and should) introduce variables without the concept of scopes (the same name used to label different variables in different contexts).  
  > **username_29**: With my wife, I have been using the names of *animals*. Obviously, my wife is not a child, but a quite intelligent woman, but her background in mathematics and statistics makes some aspects of variables in programming counter-intuitive for her, and this analogy has helped. I emphasize the name being of an animal (specifically, a turtle, since we’re practicing with a Logo-style turtle module) because *animals for the most part don’t know anything about the names we assign to them.* This helps emphasize that an object exists independently of names, and can have multiple names refer to it.  
  > **username_29**: It helps her remember that the turtle we called `louis`, and then passed into a function, is the same turtle that function just calls `turtle`, and that the turtle itself doesn’t really care what you call it.  
  > **username_30**: Not that I agree with this necessarily but I would point out another point of view. When training as a teacher we were told that it was not necessarily best to advance a child's education like this. For your daughter, she username_50 probably be able to understand this but in future years she username_50 have to relearn this at school and may become disinterested or disenfranchised entirely. I respect your drive to teach your daughter and I'm sure she is enjoying it but I would bare in mind that in a few years, this may not have been what was best for her.  
  > **username_31**: @stuartstevenson While I note that you said you don't necessarily agree with that philosophy, the idea of delaying the introduction of a concept usually taught at a later age *horrifies* me. The answer is *never* to restrict an interested student, but to get them different / better instruction if they've moved beyond the herd. Example: I moved from a city to a rural town in 6th grade, and hardly learned anything for 4 years because there was no option but "here's what everyone else is doing this term". Yes, I was often bored, but few would argue that my previous teachers did me a disservice.  
  > **username_32**: Names are references, not variables. Yes, in some modern languages, most or all variables contain references, but this is not the same, and it is a subtly or not-so-subtly different concept which would likely make things more difficult for the child... for example, humans usually never change their name; you have the "identity" stuff muddling stuff, etc.  
  > **username_33**: “In CS, a variable can actually vary” – I'd rather say in _imperative programming_, a variable can actually vary. CS per se doesn't need that.  
  > **username_34**: @stuartstevenson bored and disenfranchised now, or bored and disenfranchised later? I had this problem all through my childhood, the older I got the better I was able to self motivate. My kids have it much better, each school they have been in so far has had programs that try to tailor to the kids level. Early on I honestly feared that when when they moved on to middle school/high school the same sorts of programs wouldn't exist and being forced into a more traditional classroom would be too hard to adjust to. Seems my worry was for naught. (well until college.)  
  > **username_35**: I disagree with the bit about variables in mathematics not varying - if you have: x = 2y, you can draw a graph that shows how x and y vary in conjunction with one another.  
  > **username_19**: Actually, such a statement just defines a relationship between two values. There is nothing necessarily implied about _varying_ in it. It is _you_ that varies the values, meaning mostly that you decide to explore several (or all) pairs in the relationship. A variable in, say Java, is quite a different thing.  
  
  ---
  
  ### Answer by username_48 on 2018-01-21. Score: 26
  
  What about this?
  
  > You have a lot of values that you need to remember, so you put a label on each one (a little piece of paper to remind you what this value means) so you can find the value easily when you need it.
  
  > **Comments:**
  > **username_25**: A good variation of this, is that its a box with a number or sentence in it, and each box has a label saying whats in it. Then you can use the metaphor to ask further questions. "The Box X has some oranges in it, and 2 oranges in your hand. If you know there are 10 oranges all together, how many oranges in box X ? (  X + 2 = 10 )  
  > **username_49**: @username_25 Scratch is an object oriented system, so there are objects (including values such as string and numbers), and there are variables which have names and refer to objects. You would have to unlearn the box metaphor once you try to put the same object into two boxes. This causes constant confusion in Java where references to objects are passed by value, so people get taught that 'primitive' variables act like boxes and 'reference' variables are different, despite the physical behaviour being identical.  
  > **username_50**: @username_49 have a box labeled A with an orange in it. have two more boxes, labeled B and C, and put a note reading "A" into each. two notes, one orange.  
  > **username_49**: That would correspond to a different case, such as in C++ where you can have `a` as a pointer and `b` and `c` references to `a` (putting an apple in `a` would cause `b` and `c` to refer to the apple, not the original orange)  
  
  ---
  
  ### Answer by username_51 on 2018-01-22. Score: 18
  
  The variable that children are most familiar with is *score*: whether in computer games, sports or board games, a child username_50 almost certainly understand that a *score* is a value that is clearly not constant.
  
  Variables are abstract, but using familiar examples turns this into something easy to grasp.
  
  Once numeric variables are understood, you can extend the metaphor to cover string variables in a related example, e.g. the *word to guess* or the *player's name*.
  
  > **Comments:**
  > **username_52**: Score is arguably the best way to teach a kid about a variable. In fact, the "score" is a variable you use every day, all the time. Watch a basketball game, and ask what the Celtic's score is repeatedly throughout the game, the score changes, but it's still the score. It's a number, it changes, people talk about "the score", it's shown on the screen, etc. Perfect example. Much less nebulous than "a box" that has a number in it. My second example would be "Mad Libs".  
  
  ---
  
  ### Answer by username_47 on 2018-01-22. Score: 11
  
  Memory is a linear sequence of storage locations.
  
  Like a lined sheet of paper.
  
  Take a lined sheet of paper and choose a line.
  
  In the left margin, write a label.
  
  The variable is that label - it gives a name to a spot.
  
  Now look for the label and write something to the right of the margin.
  
  That is assignment.
  
  
  ---
  
  ### Answer by username_57 on 2018-01-22. Score: 7
  
  I just saw [username_19's answer](https://cseducators.stackexchange.com/a/4199/4036) so all credits to @username_19 and though I could simplify it with one word in a way that 9 year old me would have understood.
  
  *(Although bear in mind I was also mucking around with Visual Basic 6 at 9 years old so this could also be very inaccurate & username_42 to grasp)*
  
  **A nickname.**
  
  ```
  x = "the name of the program in scratch";
  
  ```
  
  x is the nickname of what you're making in scratch
  
  A way to implement this (not sure if possible in Scratch as I've never used it):
  Make X the title of the application/game/program and tell her to change the program's nickname (x) and then the programs full name/first name.
  
  It might also help to explain the possibility of errors (if any are possible), example being, rename the x variable where it's defined, but not referenced, then watch the errors pop up for unknown variable 'x' because you "changed the 'nickname' without telling anyone"
  
  > **Comments:**
  > **username_57**: Thank you everyone for your up votes, I'm still dumbfounded that I managed to get enough reputation to comment in this community from one comment overnight. Thanks again guys, hope my answer help(ed/s) :)  
  
  ---
  
  ### Answer by username_53 on 2018-01-21. Score: 6
  
  If I remember correctly, Scratch has two kinds of variables - object-bound and global. When teaching my son about Scratch, at the time of introducing variables I told him he had been working with object variables/properties the whole time: the *position* `x` and `y` (and to a lesser extent the object sprite/appearance (not sure what it is called in the English version of Scratch)).
  
  From there it was easy to introduce more (custom) variables as more properties of the corresponding character - whether the monster is alive or not, how much energy it has, etc.
  
  The general concept of variable (not bound to a specific object) can follow later: instead of "something we know about an object", talk of "something we know".
  
  
  ---
  
  ### Answer by username_54 on 2018-01-21. Score: 6
  
  It might be a bit indirect but around that age I bootstrapped myself from fill in the blank math problems through basic algebra to more generalized variable use.
  
  eg I started with having been given problems like:
  
  > 5 + \_\_ = 9, what number goes in the blank?
  
  From there naming the blank to get to basic algebra problem:
  
  > 5 + X = 9, solve for X.
  
  From there a programming variable just lets you use the same place holder repeatedly. (While the same is true of variables in math systems of equations, etc are probably a bit too advanced for the average 9 year old.)
  
  > **Comments:**
  > **username_19**: A variable in algebra is quite unlike a variable in computing. In your fill in the blanks, only one value username_50 be "correct". It can't vary. This username_50 become extremely confusing later and is often a stumbling block for new programmers who know algebra already.  
  > **username_54**: @username_19 it never was for me.  ¯\\_(ツ)_/¯  It was long enough ago that I don't recall if I was aware of graphing functions where variables did vary within a single expression, saw a programming variable changing as equivalent to `x` having different values in each problem in a set of questions, or something else.  
  > **username_55**: @username_19 I disagree that it's confusing. X can be anything in Dan's example. Only one value actually makes it true. I think that's kind of the entire point.  
  > **username_56**: Op's kid is "heavily interested in science, robots, computers". Shouldn't they start at the beginning and learn algebra? (+1) IME learning equations that solve for X was easy. It's expressions that I don't like, because there's no solution when there's more than one variable. If they understand mathematical expressions, wouldn't they understand variables in computing? AFAIK, you definitely need to understand what X means in an equation before you even touch expressions.  
  
  ---
  
  ### Answer by username_64 on 2018-01-21. Score: 4
  
  If this child plays Minecraft, you can try the following analogies:
  
  * A variable is like a chest with a sign next to it. You can put stuff into a chest (assignment). This "stuff" in the chest is the value of the variable.
  * A function is like a workbench, which transforms inputs (like wood) into the result (like wood planks in Minecraft).
  
  It is also helpful to explain to the child that the assignment operator (`=`) is better represented by an arrow (`<-`).
  
  Then it becomes more logical:
  
  ```
  var chest;
  
  chest = "some value"; // chest <- "some value";
  
  ```
  
  ---
  
  A completely different strategy would be to learn the assignment construct by heart. Of course, she should only learn the **building blocks** (e. g. the syntax and meaning of assignment to a variable) of programming by heart, NOT the solutions. You can add an [Anki](https://apps.ankiweb.net/) card with the following contents:
  
  Question: If you execute the statement
  
  ```
  var chest = "bla";
  
  ```
  
  what username_50 chest contain thereafter?
  
  Answer: Text (string) "bla".
  
  ---
  
  Finally, repetition is your friend. My child started to understand these concepts after we've done several algorithm lessons on [FreeCodeCamp](https://www.freecodecamp.org/). I cannot remember how often I repeated the concept of assignment to my child (always in a different programming problem) until he started to understand it.
  
  > **Comments:**
  > **username_49**: I kind of want the metaphor to involve putting the sign on a different chest. (first the sign meant one chest, then the sign meant a different chest, the chest can vary, this is called 'variable assignment' )  
  
  ---
  
  ### Answer by username_58 on 2018-01-22. Score: 3
  
  On Steam is the game [Human Resource Machine](http://store.steampowered.com/app/375820/Human_Resource_Machine/). While it is a game it is played using simple programming commands as blocks like Scratch, has an input and output conveyor and several places to hold intermediate calculations or values, think variables. Latter in the game you can even name the locations.
  
  While some of the problems are too hard for someone 9 years old, the upside of the game is that it gives you a visual representation to the abstract concept of a variable. It also has a character that moves the boxes around and performs simple operations such as add based on the commands.
  
  As such when I read your question what I see as the true question is how do I get a 9 year old to understand a variable as an abstract concept. The game gives helps in that it gives the player a concrete and visual representation of a variable as something concrete being interacted with the game character. Once the player understands what a variable is, they can abstract that away in the way professional programmers do with many concepts.
  
  Also I would not consider a variable as the first abstract concept a child learns but the concept of words and numbers. The words are typically one word to one concrete item. A number is one value to a count of concrete items. A number can also be a way to give a unique name to group of similar items. A variable in one of its simplest is one word to one item that has similar properties or relationships but that can be replaced as time progresses.
  
  When I introduce variables I state that a variable has a name but in some languages also has a type. So in teaching variables it can help to also introduce the concept of type.
  
  > **Comments:**
  > **username_19**: Actually, you get in trouble with the Python and Ruby people saying a variable (name) has a type. It isn't that the type is dynamic, it is that only the value to which it then refers has a type. Any name can refer to any value, but a value has an unchangeable type.  
  > **username_19**: For future reference, the difference between static and dynamic typing. In some languages (Java...) type checking is done prior to execution (statically), usually by the compiler, but possibly by another tool. In other languages (Python...) that isn't possible in general, so typing is done at run time (dynamically). Statically typed languages are necessarily more verbose than a similar dynamically typed one as more type information usually needs to be included by the programmer. There are exceptions. Standard ML, for example, can statically type most programs without any type notations. Cool.  
  > **username_12**: Python is "dynamic" but "strongly-typed" so you can't add 4 + "fred". JavaScript is "dynamic" and "weakly-typed" so converts types in expressions and causes endless confusion.  
  
  ---
  
  ### Answer by username_59 on 2018-01-22. Score: 3
  
  The box analogy seems good to me. If you want to continue the programming "language" analogy, variables are pronouns. In English, we rely on people using context to figure out what a pronoun refers to, but in programming we explicitly tell the computer what the pronoun refers to. You could have variable names like "it", "that", "the\_thing", "the\_other\_thing" to reinforce that.
  
  Something else to consider is to ask her how to do something. "Play dumb", so she has to be *really* explicit. If you choose the task well, she username_50 repeatedly say things like "Take the thing that you got in step 4 and ..." This username_50 then lead to the concept of "What if we could just use some short name, instead of having to say 'the thing you got in step 4' each time?"
  
  > **Comments:**
  > **username_25**: When I learn programming as a kid on the C64, the book I used , used the 'a variable is a box with a name like X or $Y that you put things in to remember'. I understood it instantly. Its a good metaphor  
  > **username_60**: +1 I also like the use of a box as a variable stand-in. It lends it's self to further analogy.  All variables (boxes) have a type (maybe colour code them).  They need to be declared (added to the program), and then they can hold anything that fits that type of box. So you can put characters, words and sentences in a red 'String' box. You can put numbers in your blue 'Integer' box, and you can put either in your purple 'Variant' box. You can explain arrays with a box of boxes, collections and lists with boxes that are just grouped together, and constants with locked boxes and so on and so on.  
  
  ---
  
  ### Answer by username_61 on 2018-01-23. Score: 3
  
  I like to explain it as a placeholder. So that I don't have to read and write so much.
  
  > I have a friend named John Jacob Jingleheimer Schmidt. His name, John Jacob Jingleheimer Schmidt, is my name too. Whenever I go out with John Jacob Jingleheimer Schmidt, the people always shout. There goes John Jacob Jingleheimer Schmidt. John Jacob Jingleheimer Schmidt is my best friend. John Jacob Jingleheimer Schmidt likes to go down the slide at the park. John Jacob Jingleheimer Schmidt has brown hair.
  
  Or I could just write at the top of the paper
  
  > JohnsName = John Jacob Jingleheimer Schmidt
  >
  > I have a friend named JohnsName. His name, JohnsName, is my name too. Whenever I go out with JohnsName, the people always shout. There goes JohnsName. JohnsName is my best friend. JohnsName likes to go down the slide at the park. JohnsName has brown hair.
  
  This often prompts "Can't I just say John instead?" and I tell them "Yep, we could even just say "J = John Jacob Jingleheimer Schmidt" and make it even shorter."
  
  "Plus if John changes his name in the future we only have to change it at the top of the paper. "
  
  > **Comments:**
  > **username_4**: I really like how this example shows abstraction in a fairly intuitive way, without having to directly define it  
  > **username_19**: Yes, but as a first cut the definition of abstraction is pretty simple: A simple name for a complex thing so that the name can be used instead of the complexity.  
  
  ---
  
  ### Answer by username_62 on 2018-01-22. Score: 3
  
  Honestly all these analogies are extremely confusing. The box analogy was the best. I would just add to it.
  
  You have a box that has its entrance restricted like those block match toys for babies (to match shapes - for example they only take circles, or stars, etc). Some boxes only take stars (int), squares (string) etc. The box is small and only has enough space to fit one shape.
  
  But your box has certain properties. The bottom of the box has a one of these restricted opening to allow blocks to be pushed out the other side. So because the box is small, if you try to push another star into the box when there is already a star in there, it pushes the old one out and then only the new one is inside. This handles the idea of replacing values. And then of course types are explicit. If you try to put another shape into the box it wont fit.
  
  When you want to use the item you stored away in the box, you tell your program (assistant) to go fetch the box from the closet and bring it back to you so you can see what's inside. If you don't use the box as storage your program (assistant) is kind of forgetful (really old assistant) and may misplace the information.
  
  So this is why you store important things you want to remember inside the boxes.
  
  I think that covers all the bases. That is how I would explain variables.
  
  This seems like a very straightforward analogy. There is no abstraction which means even a kid can understand it in terms of real physical things. Children tend to have issues understanding abstraction, which is why algebra is generally left for when their brains are more developed. So this real world simple comparison should be understandable.
  
  > **Comments:**
  > **username_19**: The box analogy has serious problems. Suppose I have 20,000 boxes? How do I find the one I want? The answer leads you deeper and deeper into username_42 to understand issues. Can I put the same shape into two different boxes? Is it really the "same" shape (value) then?  
  > **username_62**: There may be a better way to explain this, but I think this username_50 cover all the bases at her level and have her still understand it.  
  > **username_19**: I worry about explanations that don't smoothly extend to deeper explanations and that need to be "undone" before a student can move forward. I don't think the early explanation needs to be deep or complete, but it needs, at least, to be extensible. That is why I raise the issue of lots of boxes and several variables referring to the same value. If you explanation fails there, it just fails. Even a kid can raise those same questions and eventually a bright (or even random) one username_50. Never set up a situation in which you need to "unteach" anything to move forward.  
  > **username_1**: @username_19 I don't see any problems with the box metapher. If we have multiple boxes, we label them to distinguish them - just like we do give names to variables. And if we have really many of them, we need to put some structure on it, be it scoped names or arrays (rows of boxes). Regarding "same shapes", that's where most physical analogies break down. But first we would need to define the terms "same" and "value" anyway. In fact, before introducing references/pointers/objects, we do have multiple distinct but *equal* values in the boxes indeed - and some magical cloning device.  
  
  ---
  
  ### Answer by username_63 on 2018-01-24. Score: 3
  
  There are a number of fine answers already here. This is how I thought of doing it, and it might provide another alternative that should be suitable for a 9 year old, and possibly younger. It should be something that gives a good visual image for the child to picture mentally.
  
  If I were speaking to the 9 year old:
  
  > Say one day you decide you're really curious about the number of blue cars that pass your house on a typical day. That makes you think about the red cars, too, and the total number of cars.
  >
  > So, you get three cups - a blue one, a red one, and a clear one. Also you get a big stack of pennies. You sit on the porch all day. Every time a car goes by, you put a penny in the clear cup. If the car is blue, you also put a penny in the blue cup. If the car is red, you also put a penny in the red cup.
  >
  > At the end of the day, you count the number of pennies in the blue cup. That's the number of blue cars that went by. You do the same thing with the red cup, and that's the number of red cars that went by. Finally, you count the pennies in the clear cup, and that's the *total* number of cars that went by.
  >
  > The cups are variables, and each has a name - the blue cup is a variable named *blue-cars*, the red cup is named *red-cars*, and the clear cup is named *total-cars*. Each variable holds a number, the number of pennies in the cup.
  >
  > Oh, and by the way, you're the program. We can empty the cups and run you again tomorrow to count the cars.
  >
  > There are other things you can do, too. You can add the number of pennies from the blue cup and red cup, and see how many red and blue cars there were combined. If you want to get really fancy, you could count the number in the clear cup, then subtract the red cars and subtract the blue cars to see how many cars there were of other colors that you didn't count.
  
  > **Comments:**
  > **username_4**: That's a decent visual explanation. I feel like it would be understandable to a young learner, even if they're not strong in the math department, because it's less abstract than simply trying to explain the concept of a variable. Personally I'd approach it with only the blue cup for starters, to keep it as simple as possible. Once they've got a basic understanding of that, then introduce other variables like the red or clear cups, or shift it to something other than numbers. Bonus points for the "You are the program" bit :)  
  
  ---
  
  ### Answer by username_12 on 2018-01-26. Score: 2
  
  Do you use a dry-erase board anywhere to keep track of chores, or a shopping list?
  
  An *erasable space* is a great way to teach the use of a variable.
  
  You can even get into data types!
  
  Booleans - eg: a tick in a box or the words *yes/no* against a task *trash taken out*. I know one mum who had a checklist at the door, so ticking off everything on the list would be essential before going to school, then the list gets erased back to *all false* on getting home, ready for the next day.
  
  Integers - have a box for number of times someone has to dry dishes this week, with the tally written next to it. That gives the concept of accumulating and rewriting a value.
  
  A calendar on which you can only write or add stickers is a WORM (Write Once Read Many) device. Without getting into the acronym, it's a good way to discuss the idea of being able to change something vs being able to get a value from it.
  
  
  ---
  
  ### Answer by username_13 on 2018-01-22. Score: 2
  
  I find the "box" aspect is far more important than the named aspect. Maybe it's personal bias. However, we can combine the two: it's a *named* box. So you can say "Go look in the 'object color' box."
  
  If you're working with pure data (no objects), it may be effective to set up a white board, and mask off a few "boxes." Each box gets a name like "number of chores done today." Concepts like "Add 1 to the number of chores done today" start to become really meaningful that way! And it just so happens that the word for these spaces on the whiteboard is "box," which is similar to the 3d boxes you might put objects in.
  
  Even better, it puts her in an excellent position to deal with the nuanced behavior of reference mechanics when she gets there. If you're used to thinking of variables as spaces on a whiteboard, writing *references* to objects, like referencing the members of your family by name, is easier. For many people, the jump to reference mechanics is a real struggle because they got used to the idea of "x is my bear, that's in a box on the shelf" rather than "x is a variable referencing my bear. Y also references the same bear." (I personally have struggled to help people with reference mechanics because it forces them to unlearn whatever models they used up to that point, and unlearning is hard)
  
  You can even use different color markers for references and data. That starts to get them used to the idea that there is *some* fundamental difference between the word "dad" and a reference to username_0 username_0.
  
  
  ---
  
  ### Answer by username_14 on 2018-01-22. Score: 2
  
  In Python, Java, or JavaScript, I talk about the type system as an ecosystem of different species of smart data. Objects are self-aware chunks of memory to which you can send messages and which can do work for you. I username_50 frame this discussion in JavaScript.
  
  Example in Node
  
  ```
  > console.log("foo".length);
  3
  
  ```
  
  As you know, it rapidly becomes tedious to do this with literals. That's when we do this.
  
  ```
  > var x = "foo";
  > x.length
  3
  
  ```
  
  The variable is like a phone number. It gives you a means by which you can communicate with its object. Assignment binds an object to a "phone number." On a deeper level, a variable knows WHERE its object is in memory and knows how to find it. Hey, that's like your phone. If you get on an airplane and fly to Des Moines, your mother can still dial the number and ring you even though you have moved. The key idea: A variable knows how to find its object. This is my initial explanation before I get into complexities such as scope.
  
  
  ---
  
  ### Answer by username_15 on 2018-01-23. Score: 1
  
  This answer is probably a little more advanced than you're looking for, but it might help somebody else in the future, especially if they're working in a Java-like language.
  
  I really like this description: [Cup Size -- a story about variables](https://javaranch.com/campfire/StoryCups.jsp).
  
  This describes variables as cups. You have different sized cups, which means they can hold different types of things. Each cup has a name written on it, so you can say "give me the thing in the large cup with a name of X".
  
  It then talks about the more advanced idea of references, which it describes as remote controls. A remote control goes in a cup, and points to a TV.
  
  It also has a follow-up article: [Pass-by-Value Please](https://javaranch.com/campfire/StoryPassBy.jsp), which describes the fact that one TV can have multiple remote controls, each in a cup, and swapping out one of the remote controls for one that points to a different TV doesn't change the original TV. Like I said this is more advanced than you care about, but it really helped me understand the idea of pass-by-reference vs pass-by-value back when I was still figuring that stuff out.
  
  
  ---
  
  ### Answer by username_16 on 2024-09-25. Score: 1
  
  Well the question is of great importance because that of variable is arguably *the* most subtle but fundamental thing to learn, especially so at the reported young age. The subtlety remaining also for more mature people, so much that a great number of people using variables when programming are not so good in explaining what they are.
  
  There is really no computation without variables, as if you want any input to be taken care of, you username_50 need a variable (except particularly crazy languages designed specifically for the task). And it's acceptable that a computation without input is not really a computation. Granted, technically you might want to compute many digits of $\tau = 2\pi$, and you don't need any input for it (or do you?), but the example is quite clearly pathological, not representative of the normal situation that we want to teach for, and we can avoid entering this realm. **A computer that always does the same thing becomes boring soon**.
  
  So your points are really well thought out: a first explanation looking simple and wrong, and a second one looking correct but difficult. This is quite natural, being the concept *actually* difficult, it's not really possible to give a simple *and* correct explanation.
  
  The box analogy is not really so bad anyway, and it may be useful for understanding. The main obstacle in this case I would say is the "why" should one care about such boxes? I am afraid that this problem is in big part a fault of the tool: this is the main reason I don't like scratch as a beginner's tool. Yes it's nice and funny and interactive and everything, but it just lacks the most important of the concepts: that of variable/input. Or it makes it unnecessarily difficult to learn about the concept.
  
  I agree with what someone noted in the comments: when I was very young and learned about it, a variable was "a name that can/username_50 be substituted with some arbitrary value". It's also incredibly correct. It was so immediate for the young me that I remember wanting to put variables everywhere, without having a clue what I was doing, it was just *there where the magic happens*, and the magic was what interested me. For what attains to the *mechanism* of variables, this is it. There are some people who do not understand this, but I have a very hard time imagining what might be missing, being it so natural for me. I guess in the specific context of your daughter, she might be capable of understanding, given what she is already doing. For others, maybe boxes work.
  
  But the main point is still missing: *why* would we want to use variables?
  
  The effective way to learn here is usually not by some explanation, but by examples. Conceive problems and situations where variables are needed, show the idea once or twice and then experiment with novel situations. As already noted, this might not appear extremely natural in scratch. If you instead find one or more interesting ways of doing it in that environment, please let me know because I'm very curious.
  
  Of course, the name "variable" is also sometimes misleading if one is not careful: there is nothing varying, and any example situation that relies solely on changing values username_50 fail to give a profound meaning.
  
  What must be conveyed instead is the necessity **for the code to manage different situations in a homogeneous way**, which is nothing more than the idea of wanting some input.
  
  For a much better structured pedagogical path in learning from absolute zero, playfully for young ages, forget scratch and see instead the great HTDP <https://htdp.org/> .
  
  
  ---
  
  ### Answer by username_17 on 2018-01-22. Score: 1
  
  I remembered an exercise for children in the Etoys-System I read about some time ago. It does that not by explaining what a variable is but by introducing the need for variables.
  
  In the exercise children create a car in the Etoys-System (it's based on Squeak) that can drive around on the screen. They also create a steering wheel which can be used to steer the car.
  
  This demostrates the need for variables because the facing of the wheel is connected to the facing of the car. It connects two properties of the micro-world without specifying what the value of the properties is.
  
  You can find the paper with the exercise at <http://vpri.org/pdf/rn2005001_learning.pdf> says it is a good way to teach about variables. The exercise is on page 2.
  
  
  ---
  
  ### Answer by username_18 on 2018-01-21. Score: 1
  
  I'm not sure there's a "magic" explanation you can give her such that she username_50 achieve "crystal clarity." I think with most people, and especially with kids, you need to demonstrate this and then "let it sink in." One of the first programs I wrote (guided by my then much older IBM 370 systems programmer brother-in-law) specifically to learn what variables are and how they are used computed Fibonacci numbers. I think we used Fortran back then. You get the idea though.... you have a 3 variables, sum, num1 and num2. You know the rest... Get your daughter to write a program that does that. Even help her write it. A lot. Just involve her in the writing and show her how it dumps out:0, 1, 1, 2, 3, 5, 8, ...
  
  It username_50 sink in.
  
  > **Comments:**
  > **username_19**: Not many explanations are "magic" for any student of any age. An explanation should be more of a "conversation" than an "answer" so that the learner can reveal what they still don't get and the teacher can refine the explanation, filling in the needed bits until the A-Ha experience. This is why "The Perfect Lecture" is an oxymoron.  
  
  ---
  
  ### Answer by username_28 on 2018-01-22. Score: 1
  
  I would use integer math. On a sheet of paper, set up a small arithmetic table with three columns marked X, Y and 10. Include a '+' between X & Y and an '=' between Y & 10. Fill in 10 down the rows, and start by plugging figures into the X & Y. So, row 1 username_50 have 1 for X and 9 for Y, row 2 username_50 have 2 for X and 8 for Y etc.
  
  Have your daughter fill in the information for the rest of the rows and then point out that X and Y are the variables - because their values can *vary* - and can have a range of answers that are all correct.
  
  This username_50 not only point out the variable concept, but also help out when they throw algebra at her at school in a few years.
  
  
  ---
  
  ### Answer by username_20 on 2018-01-23. Score: 0
  
  Has she done basic algebra? "A white box has three marbles in it, and a blue box has four marbles in it. If I have six white boxes and five blue boxes, how many marbles have I got?" Is her maths up to this level yet? At age 9, I'd hope so.
  
  You can also make life easier by calling the variables something meaningful, which is good programming practise anyway. So your variables would be "number\_of\_marbles\_in\_a\_white\_box", "number\_of\_marbles\_in\_a\_blue\_box", "number\_of\_white\_boxes", "number\_of\_blue\_boxes", and "number\_of\_marbles". Restrain your natural tendency to use shorter names.
  
  > **Comments:**
  > **username_21**: This answer would be probably better suitable as a comment to the question.  
  
  ---
  
  ### Answer by username_22 on 2018-01-22. Score: -2
  
  The issue is that a variable is not just one thing -- it can do a variety of things -- and also, that *variables do not exist in nature*. Nothing else in a person's experience behaves in all of the ways that a variable can. So, you need a ramp that begins simply and describes the various variations of variables.
  
  Early computers did not have any programming, they were circuits connected by cables. If you wanted a push-button to affect the computer, you used a wire to connect the push-button to a circuit. When Binary Coding came along, you could get the input from the button by reading a value from a numbered memory address. Assembly language allowed you to give that address a name. You could call it ButtonValue or something, and just test it with an IF statement. But you could also define another variable, like Input1, and put the value in there, along with some other input values and then feed that to some code you wrote. Now we have the idea of named locations, and assignment. Good, but not nearly far enough.
  
  A collection of similar variables can be put together in an Array, and then a variable used to index through the array. Any child should understand that, because they have all stood in line and called out numbers one by one. Finally, there is the idea of indirection, that a variable can decide which variable to refer to. I could have a variable called Greeting, and based on the current time, put one of three other variables in it, holding values like: "Good morning", "Good afternoon" and "Good Evening". Add a variable for the student's name and this program username_50 be able to greet anyone at any time. We used variables so that the strings (Good Morning, etc) can be easily changed, possibly at the direction of a variable called Language...
  
  Nothing else in the world works that way, but with these simple examples, it should be clear to any nine year old. The problem then username_50 be keeping them off the computer. I spent a lot of hours writing programs to output geometric figures in text on a PDP-11 terminal.
  
  > **Comments:**
  > **username_23**: Welcome to [cseducators.se]! Your answer seems to be tying together many concepts, which are just slightly related to variables. It wouldn't make it simpler for a 9 year old.  
  
  ---
  
  ### Answer by username_24 on 2018-01-22. Score: -3
  
  For a nine year old, you can say that a variable is a "change item", such as weather in the environment.
  On the other hand, if it proves too challenging to explain it, you can kindly postpone this subject until she is old enough to appreciate it. Bear in mind that kids at this age are not very good in abstract thinking. Try again when she is about 12-13.
  
  > **Comments:**
  > **username_25**: No kids are fin at abstract reasoning, and theres evidence in the literature that confirms that (Think about it: Kids learn to speak ex-nihilo other than some rudimentary wetware to jumpstart grammar learning). The trick is to just not use jargon to explain jargon. "A box to put a number or sentence in" works fine.  
  > **username_26**: There is plenty of evidence to suggest that kids are not good at abstract reasoning. "Developmental psychologist Jean Piaget argued that children develop abstract reasoning skills as part of their last stage of development, known as the formal operational stage." This seems related https://www.sciencedirect.com/science/article/pii/S1878929314000516 and excerpt taken from https://www.goodtherapy.org/blog/psychpedia/abstract-thinking  
  
  ---
  
  ### Answer by username_27 on 2018-01-22. Score: -4
  
  First explain the kid meaning of variable as something that keeps changing (like weather). Then he username_50 get idea about the word and then tell him, in CS how we assign a value to the variable and how we are able to change it afterwords
  
  > **Comments:**
  > **username_2**: Can you elaborate on *how* you'd explain it? I'm not sure what you mean by "as something that keeps changing"  
  
  ---
  
  