this post was submitted on 09 May 2025
220 points (98.7% liked)

Programmer Humor

35949 readers
71 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
[–] [email protected] 4 points 3 weeks 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.