top | item 43436863

(no title)

krukah | 11 months 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.

discuss

order

IshKebab|11 months ago

That'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|11 months ago

You know what I like this much better...rule of thumb updated.