From my experience with modern programming and scripting languages, I believe most programmers are generally accustomed to referring to the first element of an array as index 0 (zero).
I'm sure I've heard of languages other than zsh
starting array indexing on 1 (one); it's okay, as it is equally convenient.
However, as the previously released and widely used shell scripting languages ksh
and bash
both use 0, why would someone choose to alter this common convention?
There does not seem to be any substantial advantages of using 1 as the first index; then, the only explanation I can think of regarding this somewhat "exclusive feature" to shells would be "they just did this to show off a bit more their cool shell".
I don't know much of either zsh
or its history, though, and there is a high chance my trivial theory about this does not make any sense.
Is there an explanation for this? Or is it just out of personal taste?
csh
, which also used one-based array indexing.