Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
DavidVoid
3 months ago
|
parent
|
context
|
favorite
| on:
Why I chose Lua for this blog
And a lot of the time it makes the syntax more compact than it would be with 0-indexing.
for i=1,#arr do foo(arr[i]) end
I don't feel that strongly for or against either way of indexing though, they both have their pros and cons.
kqr
3 months ago
[–]
Perl is usually used with the first element being zero and the same loop would be
for (0..$#arr) { foo(arr[$_]) }
Whatever you're feeling is not in starting at one.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: