Re:Again on 0-based vs. 1-based indexing
by robertlagrant on Wednesday January 20, 2021 @10:41AM
(#25847699)
How so?
[ Parent
| on HN ]
Re:Again on 0-based vs. 1-based indexing
by tester34 on Thursday January 21, 2021 @03:21AM
(#25856688)
because when you misscalculate the index, then it will not crash, but use the wrong one
I'm getting this right?
Re:Again on 0-based vs. 1-based indexing
by robertlagrant on Thursday January 21, 2021 @06:35AM
(#25857844)
I don't understand why that would be more error prone than using list[list.length-1]. It's just list[-1].
Re:Again on 0-based vs. 1-based indexing
by tester34 on Tuesday January 26, 2021 @04:50AM
(#25914068)
imagine if you used list[index] where index would be calculated
if you misscalculated something and went on negative, then you'd have big exception/error, but when negative indices are viable, then the code will work fine