Skip to main content
Notice removed Needs detailed answers by thesecretmaster

A variable is just a box you put something in. And, if later you decide you want to put something different in the box, you can.

The reason I use this analogy is quite simple. As I explained to my daughter; the box doesn't change, only the contents. Further, the contents only change if and when you decide they should. I was going to expand the idea to take in constants (i.e, a box which can never be opened) but drove myself round the twist trying to figure out how the stuff got into the box in the first place!

A variable is just a box you put something in. And, if later you decide you want to put something different in the box, you can.

A variable is just a box you put something in. And, if later you decide you want to put something different in the box, you can.

The reason I use this analogy is quite simple. As I explained to my daughter; the box doesn't change, only the contents. Further, the contents only change if and when you decide they should. I was going to expand the idea to take in constants (i.e, a box which can never be opened) but drove myself round the twist trying to figure out how the stuff got into the box in the first place!

Notice added Needs detailed answers by thesecretmaster
Source Link
user4027
user4027

A variable is just a box you put something in. And, if later you decide you want to put something different in the box, you can.