Learn first
Programs follow precise instructions
A program is a set of instructions. A variable stores a value. A condition chooses between paths. A loop repeats steps. Output is the result produced.
How to work it out Trace one instruction at a time. Keep a record of values and check exactly when a condition or repeated step is evaluated.
A separate example In a separate trace, start with n = 2, add 3, then double n. The two instructions happen in order: 5 is an intermediate value before the final result.
These sheets use pseudocode: readable instructions, not a particular programming language. SET score TO 2 gives score the value 2. SET score TO score + 3 reads the old value first, then replaces it. SHOW displays the current value without changing it.
Worked example
Trace SET score TO 2; SET score TO score + 3; SHOW score. The values are 2 then 5, and the display shows 5. A variable is a name for a value, not the printed word itself.