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.
A bug is a mistake in a program. Our goal is exactly three dots. The faulty plan says DRAW DOT twice. Trace it, compare the result with the goal, change one thing, and check again.
Worked example
Two DRAW DOT instructions make two dots. Add one more DRAW DOT instruction to make exactly three. Finding a mistake helps improve the plan; it is not a reason to give up.