460
you are viewing a single comment's thread
view the rest of the comments
[-] OddMinus1@sh.itjust.works 3 points 5 days ago* (last edited 5 days ago)

Could also be done recursive, I guess?

boolean isEven(int n) {
  if (n == 0) {
    return true;
  } else {
    return !isEven(Math.abs(n - 1));
  }
}
this post was submitted on 15 Jul 2025
460 points (94.7% liked)

Programmer Humor

37286 readers
55 users here now

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

Rules:

founded 6 years ago
MODERATORS