464
submitted 2 months ago by sirico@feddit.uk to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] OddMinus1@sh.itjust.works 3 points 2 months ago* (last edited 2 months 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 (94.8% liked)

Programmer Humor

38555 readers
154 users here now

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

Rules:

founded 6 years ago
MODERATORS