244
top 7 comments
sorted by: hot top controversial new old
[-] aktenkundig@discuss.tchncs.de 22 points 2 months ago

It's funny but also tempting me ๐Ÿ˜„

[-] ryannathans@aussie.zone 16 points 2 months ago* (last edited 2 months ago)

Isn't the logic inverted? I think you want a == 0 on each of those conditions

You wouldn't even need the first if you removed the space

[-] neukenindekeuken@sh.itjust.works 4 points 2 months ago

Correct, noticed the same thing. Should have been a bang in front of each of the terms, your modulus of any of those will return a 0 when hit, which will convert to false and fail each of those conditions.

This solution will do the opposite of what was intended unless the if conditions are inverted. Then it works flawlessly and the %15 is indeed a clever solution.

[-] MachineFab812@discuss.tchncs.de 8 points 2 months ago* (last edited 2 months ago)

Ya'know, it shouldn't be too hard to setup the โ•” and โ•š characters to function as or be substituted for quotes or brackets, depending on the language, then handle the rest as ligatures. Straight display substitution could allow for clean code and portable touch-typing, while still providing this sort of "visual training wheels" for those who want it in their own editor/ide

[-] cypherpunks@lemmy.ml 7 points 2 months ago

this is a good meme

[-] jcg@halubilo.social 2 points 2 months ago

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

this post was submitted on 09 May 2025
244 points (98.8% liked)

Programmer Humor

37457 readers
18 users here now

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

Rules:

founded 6 years ago
MODERATORS