Exit
  1. Learn
  2. Check
  3. Solve
  4. Reflect

A box can be refilled

A box does not have to keep its first value. You can put a new one in, and the old value is gone. In a game, your score changes all the time, yet it is still the same box called score.

Often the new value is worked out from the old one: take what is inside, add something, and put the result back in the same box. The computer always works out the right-hand side first.

One equals sign: means put the right side into the box on the left.
In code
score = 10
score = score + 5
The box called score
score: 10
0
line
score
10

The first line puts 10 in the box.

Move 1 of 3

Order matters

When several lines change the same box, each one starts from what the line before it left behind. So the order of the lines changes the answer.

Start with 10 points. Add 5, then double: that gives 30. Double first, then add 5: that gives 25. Same steps, different order, different result. When you solve a problem, write the steps in the order that they happen in the story.

Same lines, new order, usually a new answer.
In code
score = 10
score = score + 5
score = score * 2