Gollum@feddit.org to Programmer Humor@programming.dev · 21 days agoAnother smart movefeddit.orgimagemessage-square104fedilinkarrow-up1914arrow-down130
arrow-up1884arrow-down1imageAnother smart movefeddit.orgGollum@feddit.org to Programmer Humor@programming.dev · 21 days agomessage-square104fedilink
minus-squareJackbyDev@programming.devlinkfedilinkEnglisharrow-up8arrow-down1·21 days agoArrays not starting at 1 bother me. I think the entrenched 0-based index is more important than any major push to use 1 instead, but if I could go back in time and change it I would.
minus-squareOvershoot2648@lemm.eelinkfedilinkarrow-up1·21 days 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·21 days agoIt would screw up existing code but doing [array.length() -1] is pretty stupid.
minus-squarethedeadwalking4242@lemmy.worldlinkfedilinkarrow-up1·edit-220 days agoFor i = 0; I < array.length; i++
minus-squareKlear@lemmy.worldlinkfedilinkEnglisharrow-up0arrow-down1·21 days agoIt doesn’t make sense that the fourth element is element number 3 either. Ultimately it’s just about you being used to it.
minus-squarePika@sh.itjust.workslinkfedilinkEnglisharrow-up1·20 days agothis is what messed me up with ZSH for a bit, having a shell default to 1 instead of 0 was weird
Arrays not starting at 1 bother me. I think the entrenched 0-based index is more important than any major push to use 1 instead, but if I could go back in time and change it I would.
Also remove null reference
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.
this is what messed me up with ZSH for a bit, having a shell default to 1 instead of 0 was weird
Rare zshell L