Loop Debugging

Find and fix off-by-one and exit bugs.

Lesson 4

Concept

Common issues: wrong start/end indices, not updating loop variable, mutating while iterating. Use prints or a debugger to inspect state each iteration.

Try it