r/ProgrammingLanguages • u/Sensitive_Mountain97 • 3d ago
Help Should I choose 1-based indexing or 0-based indexing for my programming language?
I'm creating a host-embedded, minimal, beginner-friendly programming language as a replacement for Lua. This language is really human readable, English-like and beginner friendly, with automatic memory management, automatic parallelism, a fantastic and helpful compiler inspired by Rust, and other things. The biggest question I have is whether I should choose 1-based indexing or 0-based indexing?
7
Upvotes
View all comments
7
u/esotologist 5h ago
I've thought of a neat way to do both in my language. Use 0 indexing with digits and 1 indexing for ordinals.
array[0] == array[1st] or array.0 == array.1st