this post was submitted on 09 May 2025
235 points (98.4% liked)

Programmer Humor

35897 readers
1 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] jcg@halubilo.social 2 points 3 weeks ago (1 children)

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

[โ€“] Bogasse@lemmy.ml 2 points 3 weeks ago

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).