Why do loops start at zero (0) instead of one (1)?

Asked by kemiadewale · 6 months ago

1 Answer

13
amorebise · 6 months ago Top Answer

This confuses everyone at first! It's because the computer sees the index as an 'offset' or 'distance' from the start. The first item has zero distance from the beginning.

It's like the ground floor of a building. In some places, we call it floor 0. Don't worry, you'll get used to it. Just remember: zero is the first number for a coder!

Log in to add a comment.