Boxi Learn › Computing › Stage 3 · Structure and Evidence
Variables are labelled boxes
CS-1 Break a big job into small stepsCS-4 Mistakes are normal — find themX-1 Guess, then check
What many people think
Writing 'a = b' and then 'b = a' swaps the two values.
The idea
A variable is a named box that holds one value at a time; putting a new value in throws the old one away, so swapping two boxes needs a third.
Explain it
Your friend wrote a = b and then b = a to swap two numbers, and both came out the same. Explain what happened to the first number, and how a third box fixes it.
Try at home
Two cups: one with water, one with juice. Swap what is in them. What did you need? Write down each move as a line like “empty cup = water cup”.