Gollum@feddit.org to Programmer Humor@programming.dev · 20 hours agoAnother smart movefeddit.orgimagemessage-square82fedilinkarrow-up1719arrow-down122
arrow-up1697arrow-down1imageAnother smart movefeddit.orgGollum@feddit.org to Programmer Humor@programming.dev · 20 hours agomessage-square82fedilink
minus-squareIndustryStandard@lemmy.worldlinkfedilinkarrow-up5·9 hours agoIt would screw up existing code but doing [array.length() -1] is pretty stupid.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up4·edit-25 hours agoFor i = 0; I < array.length; i++
minus-squarexthexder@l.sw0.comlinkfedilinkarrow-up4·8 hours agoi < array.length or else you overflow.
minus-squaredan@upvote.aulinkfedilinkarrow-up2·8 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.