nave@lemmy.zip to Lemmy Shitpost@lemmy.worldEnglish · 11 months agoI wishi.imgur.comimagemessage-square189fedilinkarrow-up1928arrow-down117
arrow-up1911arrow-down1imageI wishi.imgur.comnave@lemmy.zip to Lemmy Shitpost@lemmy.worldEnglish · 11 months agomessage-square189fedilink
minus-squaremellejwz@lemmy.worldlinkfedilinkEnglisharrow-up1arrow-down2·11 months agoIt will check all of the if statements instead of stopping at the first match.
minus-squaremellejwz@lemmy.worldlinkfedilinkEnglisharrow-up2·11 months agoMy bad, I looked over the returns. If you return something there wouldn’t be much difference between both.
minus-squareCosmicomical@lemmy.worldlinkfedilinkarrow-up1·11 months 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·11 months 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!