Gollum@feddit.org to Programmer Humor@programming.dev · 1 day agoAnother smart movefeddit.orgimagemessage-square86fedilinkarrow-up1780arrow-down126
arrow-up1754arrow-down1imageAnother smart movefeddit.orgGollum@feddit.org to Programmer Humor@programming.dev · 1 day agomessage-square86fedilink
minus-squareIndustryStandard@lemmy.worldlinkfedilinkarrow-up6·14 hours agoIt would screw up existing code but doing [array.length() -1] is pretty stupid.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up4·edit-29 hours agoFor i = 0; I < array.length; i++
minus-squarexthexder@l.sw0.comlinkfedilinkarrow-up4·12 hours agoi < array.length or else you overflow.
minus-squaredan@upvote.aulinkfedilinkarrow-up2·13 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.