Unit 05 · reflection

Unit 5 Loop Forensics

Choose one loop from your project and freeze it after three iterations.

Record:

starting state
iteration 1 state
iteration 2 state
iteration 3 state
termination rule

Now change one part of the loop so that it behaves incorrectly. Use the resulting output or trace to identify whether the failure is:

  • an off-by-one boundary;
  • a state-update problem;
  • a termination problem; or
  • a logic problem inside the body.

End by stating the evidence that proves your repaired loop processes the intended number of cases.