Iteration means running a set of instructions repeatedly. A useful loop has a starting state, a condition that decides whether another pass is needed, a body, and an update. Trace these elements before trying to reason about how many times a loop executes.
int count = 0;
while (count < 3)
{
count++;
}The loop tests 0, 1, 2, and finally 3. The body runs for the first three tests only. The final test is still important: it provides the false result that ends repetition. The value after the loop is 3, not 2.
Iteration count and final variable value answer different questions. The body executes three times, but the condition is evaluated four times: once before each body pass and once more to exit. A trace with four condition rows makes the last false check visible. When teaching a different loop, make the same distinction between checks and completed passes.
Make a small trace with one row per condition check. Record count before the check, the Boolean result, and count after the body when it runs. This method works for loops over animals, passengers, or data items.