lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On 3 Apr 2018, at 23.43, Axel Kittenberger <axkibe@gmail.com> wrote:
> 
> Time: The first hour of a day on a digital clock in 24h mode is hour 0 (after midnight). 
> 
> Similary we measure our age with completed years, starting with year 0 and many other measuring devices start their units with 0. 

But these are not indices, aren’t they? Time (like distance) is actually a delta measured from some reference point (midnight or birth in these cases). 

Indices would be 1st hour after midnight or 1st year of your life.

I think in a language without pointers, starting counting from 1 is the right way. This way you don’t need to subtract 1 from the upper limit when counting. In practice, the only thing which is slightly more complicated is wrap around when decrementing.

Petri