Hacker News new | ask | show | jobs
by dagmx 2164 days ago
Edit: brain not woken up yet. It’s because of zero indexing.

β€”β€”β€”-

Original question: Out of curiosity, why the +1?

2 comments

Arrays start at 0. example_array[5] is actually the 6th number in the array.
Ah yeah that makes sense. I was thinking the `i` check already accounted for the zero indexing.
Zero indexing probably
Makes sense. My brains clearly not woken up yet because I thought the `i` check accounted for the zero indexing.