that's all... why arrays start at zero? I think it would be more practical to start with one. I do not mean just to xojo... In most languages it happens that way
I assume it's because the index of an array is pointing to an offset within your systems memory.
Historical reasons. And array position zero was often used for other purposes. But no, "most" other languages do NOT start at 1.
P.S. Oops, Sascha beat me to it.
if you wish to start the address at 1 then all you have to do is make the array 1 larger than you need and just ignore array(0) totally and never use it.
= recipe for disastrous coding. Way, way back I used to do this. Future Basic (remember that?) had an option to start arrays at 1. Caused me untold headaches.
I really liked this explanation (http://developeronline.blogspot.com.ar/2008/04/why-array-index-should-start-from-0.html)...
The discussion over why the array index should start at zero is not a trivial one and relates to interesting concepts from computer science. First of all, it has strong relation to language design. For example in C, the name of an array is essentially a pointer, a reference to a memory location, and so the expression array[n] refers to a memory location n-elements away from the starting element. This means that the index is used as an offset. The first element of the array is exactly contained in the memory location that array refers (0 elements away), so it should be denoted as array. Most programming languages have been designed this way, so indexing from 0 is pretty much inherent to the language.
Your comments have been great and enlightening
link 1 [or zero :-)]--> http://developeronline.blogspot.com.ar/2008/04/why-array-index-should-start-from-0.html
Information in Spanish extracted from the previous link--> Esta es la respuesta de Edsger Dijkstra publicada en Hacker News y que fue enviada como una carta personal del famoso programador a un colega en 1982. La primera respuesta de Dijkstra dice que para denotar una secuencia de números naturales es mejor una notación 0 < i < N, que una 1 <= i < N+1. Habla también de experiencias donde una notación que empieza en 1 lleva a errores al leerla y no determinar bien los límites inferiores/superiores que se quieren denotar--> I think this is a great explanation
i think this is a great explanation too (@Sascha Schneppmueller)--> I assume it's because the index of an array is pointing to an offset within your systems memory
Starting an array at "0" comes from old times when computer memory was very small. At that time, starting at "1" means a waste of valueble memory space.
I created applications where I had less than 5 KB for the application itself and its data in RAM.
Nowadays developers are spoiled.