Report an Error

Reported page · Common Mistake

Forgetting That List Indexes Start at Zero

/mistakes/computer-science-zero-based-indexing/

or drop them here

Up to 3 images or PDFs, 5 MB per file. 0 of 3 attached.

Save resource to class

Loading your classrooms…

Computer Science

Forgetting That List Indexes Start at Zero

Treating the first item in a list as index 1 instead of index 0.

Quick check

Why students make it

People count starting at one in everyday life, so the first item feels like number one.

The rule done right

In most languages the first element is at index 0 and the last is at index length minus 1. A list of 5 items has indexes 0 through 4.