Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did the designers of ColdFusion decide to index arrays from 1 rather than 0?

I'm just curious about this really, does anyone know why they broke convention on this one?

Thanks, Ciaran

like image 729
Ciaran Archer Avatar asked Jan 07 '09 14:01

Ciaran Archer


People also ask

Why do we start indexing from 0 in array?

An array arr[i] is interpreted as *(arr+i). Here, arr denotes the address of the first array element or the 0 index element. So *(arr+i) means the element at i distance from the first element of the array. So array index starts from 0 as initially i is 0 which means the first element of the array.

What is array in ColdFusion?

ColdFusion arrays are a fundamental part of writing programs in ColdFusion. An array is simply an ordered stack of data items with the same data type. Using an array, you can store multiple values under a single name. Instead of using a separate variable for each item, you can use one array to hold all of them.


1 Answers

There's two conventions, the one common to most programming languages, and the one common to most nonprogrammers. They were probably aiming at the people who don't start counting with 0.

like image 62
David Thornley Avatar answered Sep 29 '22 01:09

David Thornley