4 ms·
sounds like a great way to introduce bugs
by tester34 6y ago
sounds like a great way to introduce bugs
- robertlagrant 6y agoHow so?
- tester34 6y agobecause when you misscalculate the index, then it will not crash, but use the wrong one I'm getting this right?
- robertlagrant 6y agoI don't understand why that would be more error prone than using list[list.length-1]. It's just list[-1].
- tester34 6y agoimagine 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