Thinking in code · Repeating

Off by one

The commonest loop bug is one pass too many or too few, and it hides at the two ends of the loop.