4 ms·
Whenever I explain to someone when or why to use 0-indexing, I like to say: Start from 0 if you are counting boundaries (fenceposts, memory addresses) Start f
by krukah 2y ago
Whenever I explain to someone when or why to use 0-indexing, I like to say:
Start from 0 if you are counting boundaries (fenceposts, memory addresses)
Start from 1 if you are counting spaces (pages in a book, ordinals)
Floors are a case where both make intuitive sense, which is maybe how we ended up with European vs American floor numbering.
- IshKebab 2y agoThat's a very confused way of thinking about it IMO. I say: * Start from 0 if you are indexing. I.e. you are identifying an item or its position. * Start from 1 if you are counting. I.e. you are saying how many items there are. It doesn't matter what it is. I don't know why you think pages in a book are somehow different to memory addresses.
- krukah 2y agoYou know what I like this much better...rule of thumb updated.