Ruby arrays are ordered, integer-indexed collections of any object. Each element in an array is associated with and referred to by an index. Array indexing starts at 0, as in C or Java.
Why are things 0 indexed?
The most common answer to the array numbering question, points out that zero-based numbering comes from language design itself. … As we can see on this example, the first element and the array itself points to the same memory location, so it is 0 elements away from the location of the array itself.
What is O based indexing?
Zero-based numbering is a way of numbering in which the initial element of a sequence is assigned the index 0, rather than the index 1 as is typical in everyday non-mathematical or non-programming circumstances.