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