+ 5

Is there any language in which array indexing starts from 1?

23rd Aug 2017, 2:58 PM
Manjusha Vvpb
Manjusha Vvpb - avatar
11 Réponses
+ 6
no, cause first number in program is 0, yes, if you made it in your own programming language
23rd Aug 2017, 3:05 PM
Amethyst Animion
Amethyst Animion - avatar
+ 5
Yes, there is a programming languages that does that... If I recall, Fortran uses it, but I haven't messed with that in ages. https://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28array%29#Array_system_cross-reference_list ^There you go. Whole list.
23rd Aug 2017, 3:12 PM
AgentSmith
+ 3
Thank you @Ipang and @Netkos Ent
23rd Aug 2017, 3:21 PM
Manjusha Vvpb
Manjusha Vvpb - avatar
+ 3
Thank you @ Sam.... @Calvin I just wanted to know if there were any programming languages like that. Of course once if you're used with the 0-index, changing that habit would be difficult...
24th Aug 2017, 1:19 AM
Manjusha Vvpb
Manjusha Vvpb - avatar
+ 2
Before VB.Net there was VB classic (VB6) it has a directive to define the base index of array, if the directive is omitted by default array index starts from zero, it is defined by typing Option Base 1 at the beginning of the code blocks. When the directive is defined arrays index starts from one
23rd Aug 2017, 3:15 PM
Ipang
+ 2
Programs with index start from 0 for some reasons, it makes us easier to access the data correctly. I won't use a program if its indexing starts from 1, its indexing is just inefficient.
23rd Aug 2017, 3:30 PM
Calviղ
Calviղ - avatar
+ 2
It's no more or less efficient, at least from a program's perspective. If you're always use to 0-index, then sure, it'll be less efficient if you bring in your previous habits. Otherwise, the offset doesn't impact much beyond that. For me, it starting at 0 makes sense and is also what I'm use to using. It's 0 because it's a starting point, so there is no offset yet, thus 0. For each offset from the first position, you add 1. So 0 starting, then 1 for the next spot, etc...
23rd Aug 2017, 3:58 PM
AgentSmith
+ 2
Lua starts at 1 by default.
19th Dec 2017, 11:10 PM
Joel Deslo
Joel Deslo - avatar
+ 1
Matlab 🤤
23rd Aug 2017, 6:19 PM
S C
+ 1
Fortan Basic R Julia ADL etc
18th Sep 2022, 12:42 AM
Omar
Omar - avatar
0
Surely Octave
22nd Sep 2018, 10:20 AM
zoo