# Programming Languages where indices start from 1 (NOT 0)

Strongly suggest you to get your own portfolio site and show us :)

There are 20 Programming Languages in the World where the array index starts from 1 and not from 0. Some of the popular languages include R, COBOL, Matlab and Julia.

Most programmers think that array indices start with 0 always but this is not the case. The start index of 0 or 1 is decided based on various factors.

The 20 Programming Languages where indices start from 1 (NOT 0) are:

- ALGOL 98
- APL
- AWK
- CFML
- COBOL
- Fortran
- FoxPro
- Julia
- Lingo
- Lua
- Mathematica
- Matlab
- PL/I
- RPG
- R
- Ring
- Sass
- Smalltalk
- Wolfram Language
- XPath/ XQuery

# History

C, one of the most popular languages, use array index as 0 as the index 0 maps more naturally to memory addresses.

```
base address + index * (memory size of element)
```

In fact, there are programmers for whom the starting index of 1 is more natural. Hence, some Programming Languages have adopted array index 1.

Moreover, for high level Programming Languages, it does not matter if the index is 0 or 1 as it has to manage both indexes equally.

# 1968 - till date

One may imagine that index 1 is a design flaw. If this was the case, then we should see index 1 only in old languages but the fact is that index 1 has been adopted in new Programming Languages like Julia as well.

In 1957, Fortran was formed with the starting array index as 1.

In 2012, Julia Programming Language was formed with the starting array index as 1.

In 2021, a new language by the name of "Ring" was released which had array index as 1.

The Programming Language in terms of year are:

- FORTRAN (1957)
- COBOL (1959)
- RPG (1959)
- PL/1 (1964)
- APL (1966)
- ALGOL 68 (1968)
- Smalltalk (1972)
- AWK (1977)
- MATLAB (1984)
- Mathematica (1988)
- Wolfram (1988)
- FoxPro (1989)
- Lingo (1989)
- Lua (1993)
- R (1993)
- CFML (1995)
- Sass (2006)
- XQuery (2007)
- Julia (2012)
- Ring (2021)

Hence, the summary of number of programming Languages with starting array index 1 is:

- Before 2000: 16
- 2000 to 2010: 2
- 2010 to 2020: 2

# Mathematics focused Languages

Nearly all Mathematics focused programming languages use 1-based indexing like:

- APL
- Fortran
- Julia
- MATLAB
- R
- Wolfram

This is because these programming languages are **used by Mathematicians** who are not familiar using 0 index as index 1 is more natural. For example, the first element in the set is referred as 1 without any confusion.

Hence, there are several Programming Languages that use the starting index of array as 1 and it is more of the convention used by the designers keeping in mind the use-case and users of the language (like core Programmer or Mathematicians or Enthusiast).