Indexes are not meant to counting, but accessing the elements of a vector/matrix.

You can tell me any number from 0 to 11 and I’ll pick the correct egg for you.

In Pascal we can even define ANY arbitrary base and ending index of a range. Imagine a Xojo syntax like:

```
Var vector("X".."Z") As Integer
vector("X") = 1
vector("Y") = 2
vector("Z") = 3
```

The reason for zero starting in most modern languages is just because doing so it can make compiled code faster and compilers simpler, because the index does not add extra math (as adding or subtracting values) to get a base zero index used to calculate an offset in a vector.

Yes. Offsets must clearly start at zero, while counting starts at one.

Math oriented languages like FORTRAN, Matlab, Mathematica, Julia, R starts from 1 because most math concepts are tied to the old concept of counting from 1 and some formulas could be applied without changes from the blackboard to the code.

Everything depends on the domain being applied. Languages targeting speed chooses 0, languages targeting mathematicians, chooses 1.

VB could create arrays with any start point and any end point. You could do the following:

```
Dim MyArray( 10 to 20 ) as String
```

There was an equivalent of a pragma statement also, which would define the default base for arrays:

```
Option Base 1 // to make the first element 1
Option Base 0 // to make it start at 0
```

Useful when brining code from other platforms. AppleSoft basic started at 1, as far as I can remember 35 years ago.

I wish I could find the article (maybe last 6 months or so) that talked about this exact topic. IIRC there’s no real ‘technical’ reason why it’s 0 instead 1. It’s all about what the designers of the language needed.

Technically starting at 0 will save you at least one machine code decrement instruction to fix the index to calculate the offset.

If you intend to get the max from your clock ticks, opting for base 0 is a technical reason.

I wish I had the article to share. It debunked that theory too.

Makes no sense to me.

0 based access:

1 based access:

Zero based = 18 machine code bytes

One based = 22 machine code bytes

Agreed, and it gets worse with larger number bases (line 10 to 20), as it becomes a subtraction.

Zero to me is the topic, the abstraction, the category. Zero apples means we’re discussing the category of apples. One is when the abstract becomes concrete, when the “word became flesh.” When you count backwards from 1 to 0 you are leaving one realm for another, the concrete for the abstract.

Eh? we’re talking about the *offset* from the beginning of an array. Any *offset* must start at zero. If you want to *count* the elements, then that starts at one. Simples.

Nope. The zeroth is the ordinal number of the element that comes before the first, the first is the ordinal number of the element that comes before the second and so on.

Using the Markus image, the order is declared as “there are 12 eggs ordered from left to right, top to down, zero based”:

i => 0 to 11

Given any i, you can pick the correct egg following the defined order, just it. No deeper philosophy involved.

I will take 8-9-10-11 scrambled please

That would be 11-9-10-8

lol

@Ian_Kennedy I meant scrambled then ordered