this post was submitted on 15 Jul 2025
456 points (94.9% liked)

Programmer Humor

37227 readers
117 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
[–] thann@lemmy.dbzer0.com 9 points 2 days ago (8 children)

You could use a loop to subtract 2 from the number until it equals one or zero

[–] TimeSquirrel@kbin.melroy.org 8 points 2 days ago (7 children)

Or literally just look at its binary representation. If the least significant digit is a "1", it's odd, if "0", it's even. Or you can divide by 2 and check for a remainder.

Your method is just spending time grinding away CPU cycles for no reason.

[–] thann@lemmy.dbzer0.com 4 points 2 days ago

What should all the non binary people do then you bigot

load more comments (6 replies)
load more comments (6 replies)