3 ms·
> Well, the rest of the world also starts at 0 Yes, they do, when they have no elements. But if an array has an element 0, it actually has 1 element, not 0. Wh
by lucumo 17y ago
> Well, the rest of the world also starts at 0
Yes, they do, when they have no elements. But if an array has an element 0, it actually has 1 element, not 0. Whereas if I have a sheep 1, I have 1 sheep. There is no sheep 0.
I think it would be good to note that I have nothing against 0 as a number. It's useful for many purposes including to indicate that a set actually has 0 elements, but I'm not so sure it's such a good idea to actually call the first element element 0.
- jacquesm 17y agoYou are confusing 'rank' with 'count'.
- lucumo 17y agoNot that I know of. Normal people and programmers do not count the same way. | last | | rank | count ------+------+------- sheep | 2 | 2 sheep | 1 | 1 sheep | - | 0 ------+------+------- array | 1 | 2 array | 0 | 1 array | - | 0
- jacquesm 17y agoProgrammers are pretty normal people :) When counting sheep in a field I'll count 1 sheep, 2 sheep etc. When counting variables I'll say one variable, two variables and so on. No difference there. When placing items in an array I say this value goes in to slot '0', this will go into slot '1'. The slots are labelled with their index. And I will say there are now two values stored in the array, one at 'position' 0 and one at 'position' 1. I think the whole problem disappears when you think of 'rank' as labels and count as the actual number of elements. The first sheep is just a label you stick on a sheep to identify it, that makes it different from the other sheep.