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.
WHILE checks its condition before each iteration. Trace SET count TO 0; WHILE count < 3: SET count TO count + 1; END; SHOW count. Use integer values and update your trace after each body execution.
Worked example
The condition is true at count 0, 1 and 2. Each pass adds 1. At count 3 the condition is false, so the loop stops and SHOW displays 3.