HiddenLayer555@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 4 days agoMom can we have Scratch? We have scratch at home. Scratch at home:lemmy.mlimagemessage-square7fedilinkarrow-up1226arrow-down12cross-posted to: programmer_humor@programming.devprogramminghumor@lemmy.world
arrow-up1224arrow-down1imageMom can we have Scratch? We have scratch at home. Scratch at home:lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 4 days agomessage-square7fedilinkcross-posted to: programmer_humor@programming.devprogramminghumor@lemmy.world
minus-squarejcg@halubilo.sociallinkfedilinkarrow-up3·3 days agoHuh, I had never considered this solution to fizzbuzz to be honest. I usually go for string concatenation, or (i % 3 == 0 && i % 5 == 0), but yeah i % 15 == 0 is certainly a clever simplification
minus-squareBogasse@lemmy.mllinkfedilinkarrow-up2·3 days agoI think it’s worse at conveying the intention and should be a compile-time simplification (I’m too lazy to check if compilers would do it though).
Huh, I had never considered this solution to fizzbuzz to be honest. I usually go for string concatenation, or (i % 3 == 0 && i % 5 == 0), but yeah i % 15 == 0 is certainly a clever simplification
I think it’s worse at conveying the intention and should be a compile-time simplification (I’m too lazy to check if compilers would do it though).