nave@lemmy.zip to Lemmy Shitpost@lemmy.worldEnglish · 1 year agoI wishi.imgur.comimagemessage-square186fedilinkarrow-up1919arrow-down117
arrow-up1902arrow-down1imageI wishi.imgur.comnave@lemmy.zip to Lemmy Shitpost@lemmy.worldEnglish · 1 year agomessage-square186fedilink
minus-squaremellejwz@lemmy.worldlinkfedilinkEnglisharrow-up1arrow-down2·1 year agoIt will check all of the if statements instead of stopping at the first match.
minus-squaremellejwz@lemmy.worldlinkfedilinkEnglisharrow-up2·1 year agoMy bad, I looked over the returns. If you return something there wouldn’t be much difference between both.
minus-squareCosmicomical@lemmy.worldlinkfedilinkarrow-up1·1 year agoOk just to clarify this was a joke. It was just a pedantic improvement on a deranged solution. The only sensible way to do this is with % 2 or with bitwise operations imo.
minus-squareValmond@lemmy.mindoki.comlinkfedilinkarrow-up1·1 year agoYeah gotta store the return value in a variable!
It will check all of the if statements instead of stopping at the first match.
Each clause already returns
My bad, I looked over the returns. If you return something there wouldn’t be much difference between both.
Ok just to clarify this was a joke. It was just a pedantic improvement on a deranged solution. The only sensible way to do this is with % 2 or with bitwise operations imo.
Yeah gotta store the return value in a variable!