Gollum@feddit.org to Programmer Humor@programming.dev · 5 months agoAnother smart movefeddit.orgimagemessage-square104linkfedilinkarrow-up1920arrow-down131
arrow-up1889arrow-down1imageAnother smart movefeddit.orgGollum@feddit.org to Programmer Humor@programming.dev · 5 months agomessage-square104linkfedilink
minus-squareOvershoot2648@lemm.eelinkfedilinkarrow-up1·5 months agoIt really doesn’t make sense to start at 1 as the value is really the distance from the start and would screw up other parts of indexing and counters.
minus-squareIndustryStandard@lemmy.worldlinkfedilinkarrow-up1arrow-down1·5 months agoIt would screw up existing code but doing [array.length() -1] is pretty stupid.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up1·edit-25 months agoFor i = 0; I < array.length; i++
minus-squareKlear@lemmy.worldlinkfedilinkEnglisharrow-up0arrow-down1·5 months agoIt doesn’t make sense that the fourth element is element number 3 either. Ultimately it’s just about you being used to it.
It really doesn’t make sense to start at 1 as the value is really the distance from the start and would screw up other parts of indexing and counters.
It would screw up existing code but doing [array.length() -1] is pretty stupid.
For i = 0; I < array.length; i++
It doesn’t make sense that the fourth element is element number 3 either.
Ultimately it’s just about you being used to it.