Gollum@feddit.org to Programmer Humor · 19 hours agoAnother smart movefeddit.orgimagemessage-square79fedilinkarrow-up1712arrow-down122
arrow-up1690arrow-down1imageAnother smart movefeddit.orgGollum@feddit.org to Programmer Humor · 19 hours agomessage-square79fedilink
minus-squareIndustryStandard@lemmy.worldlinkfedilinkarrow-up5·8 hours agoIt would screw up existing code but doing [array.length() -1] is pretty stupid.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up4·edit-24 hours agoFor i = 0; I < array.length; i++
minus-squarexthexder@l.sw0.comlinkfedilinkarrow-up4·7 hours agoi < array.length or else you overflow.
minus-squaredan@upvote.aulinkfedilinkarrow-up2·7 hours agoA lot of languages have a .last() or negative indexer ([-1]) to get the last item though.
It would screw up existing code but doing [array.length() -1] is pretty stupid.
For i = 0; I < array.length; i++
i < array.length
or else you overflow.A lot of languages have a
.last()
or negative indexer ([-1]
) to get the last item though.