464
you are viewing a single comment's thread
view the rest of the comments
[-] OddMinus1@sh.itjust.works 3 points 1 year ago* (last edited 1 year 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
464 points (95.0% liked)

Programmer Humor

43158 readers
1 users here now

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

Rules:

founded 7 years ago
MODERATORS