in reply to Not understanding while loop counting
Consider the steps
- Set count to zero.
- Check if count is less than ten. It is zero.
- Increment count to one.
- print count (1)
- Do this a few more times........then...
- Check if count is less than ten. It is nine.
- Increment count to ten.
- Print count (10)
- Check if count is less than ten (it is 10, so it is not less)
- Do not enter loop body; we're done.
See: Off by one error