baatliwala@lemmy.world to Programmer Humor@programming.dev · 8 days agoLook at the way he writes for loops too smhlemmy.worldimagemessage-square40fedilinkarrow-up1453arrow-down112
arrow-up1441arrow-down1imageLook at the way he writes for loops too smhlemmy.worldbaatliwala@lemmy.world to Programmer Humor@programming.dev · 8 days agomessage-square40fedilink
minus-squareJohnAnthony@lemmy.dbzer0.comlinkfedilinkarrow-up7·7 days agoBeginner mistake, which is perfectly fine! Just use i-1 inside the loop and i <= values.Length as the condition.
minus-squareChickenLadyLovesLife@lemmy.worldlinkfedilinkEnglisharrow-up3·7 days agoMy favorite: for (int i = myArray.Length; i --> 0; ) { //do something } Perfectly valid in C-style, even if it does look a bit puzzling at first.
minus-squareChickenLadyLovesLife@lemmy.worldlinkfedilinkEnglisharrow-up3·6 days agoFrom the river to the C
Beginner mistake, which is perfectly fine! Just use
i-1inside the loop andi <= values.Lengthas the condition.My favorite:
for (int i = myArray.Length; i --> 0; ) { //do something }Perfectly valid in C-style, even if it does look a bit puzzling at first.
That should be a war crime.
From the river to the C