Gollum@feddit.org to Programmer Humor@programming.dev · 2 days agoAnother smart movefeddit.orgimagemessage-square114fedilinkarrow-up1960arrow-down131
arrow-up1929arrow-down1imageAnother smart movefeddit.orgGollum@feddit.org to Programmer Humor@programming.dev · 2 days agomessage-square114fedilink
minus-squareIndustryStandard@lemmy.worldlinkfedilinkarrow-up8·2 days agoIt would screw up existing code but doing [array.length() -1] is pretty stupid.
minus-squaredan@upvote.aulinkfedilinkarrow-up3·2 days agoA lot of languages have a .last() or negative indexer ([-1]) to get the last item though.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up3·edit-22 days agoFor i = 0; I < array.length; i++
minus-squareIndustryStandard@lemmy.worldlinkfedilinkarrow-up3·1 day agoCasually throws in capitals as well.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up2·1 day agoMy post is a work of fiction
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++
Casually throws in capitals as well.
My post is a work of fiction
i < array.length
or else you overflow.