3 ms·
We aren't talking about counting. We are talking about indexing. Most programs don't need numeric indexing. They can either treat indices as opaque keys or the
by adfgoinionio 3y ago
We aren't talking about counting. We are talking about indexing.
Most programs don't need numeric indexing. They can either treat indices as opaque keys or they can use a foreach loop to avoid touching indices at all (or friends like map, filter, zip, and so forth). Even in an old language like C the only place indices usually matter is in the first line of a for loop. But sometimes you really do need numeric indices, and when you do zero-based indices are almost always cleanest.
Just think of how gnarly a flat 2D array would be if you had to use one-based indices. Gross!