+ 5
Is there any language in which array indexing starts from 1?
11 Respuestas
+ 6
no, cause first number in program is 0,
yes, if you made it in your own programming language
+ 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.
+ 3
Thank you @Ipang and @Netkos Ent
+ 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...
+ 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
+ 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.
+ 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...
+ 2
Lua starts at 1 by default.
+ 1
Matlab 🤤
+ 1
Fortan Basic R Julia ADL etc
0
Surely Octave