vrok / have

The Have Programming Language
http://havelang.org
BSD 2-Clause "Simplified" License
272 stars 11 forks source link

Add a "last()" function that is like (len()-1) #11

Open TomOnTime opened 8 years ago

TomOnTime commented 8 years ago

A major source of off-by-one errors for me is that with 0-based indexing there is no simple way to know the last element in an array. len(foo)-1 is convoluted.

Feature request: last(foo) should be the same as (len(foo)-1) thus making the intent very clear.

vrok commented 8 years ago

That's a good idea and I thing we should implement it.