this post was submitted on 31 Oct 2024
387 points (98.7% liked)

196

16552 readers
2027 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 14 points 3 weeks ago (2 children)

I remember coding actionscript in Flash and using modulo (%) to determine if a number was even or odd. It returns the remainder of the number divided by 2 and if it equals anything other than 0 then the number is odd.

[–] [email protected] 25 points 3 weeks ago

Yeah. The joke is that this is the obvious solution always used in practise, but the programmer is that bad that they don't know it and use some ridiculous alternative solutions instead.

[–] [email protected] 20 points 3 weeks ago

I believe that's the proper way to do it.