465
Peak code reuse (eviltoast.org)
you are viewing a single comment's thread
view the rest of the comments
[-] cogman@lemmy.world 7 points 1 month ago* (last edited 1 month ago)

Fixed

boolean isOdd(int num) {
  if(num == 1)
    return true;
  if(num > 0)
    return isEven(num - 1);
  else
    return isEven(num + 1);
}

boolean isEven(int num) {
  if(num > 0)
    return isOdd(num - 1);
  else
    return isOdd(num + 1);
}
[-] affiliate@lemmy.world 11 points 1 month ago

the downside with this approach is that it will eventually terminate. the version in the original post has the advantage of giving me plenty of time to contemplate life’s many mysteries.

[-] cogman@lemmy.world 4 points 1 month ago

What can I say, I'm a performance nerd.

[-] Valmond@lemmy.world 1 points 1 month ago
this post was submitted on 12 Sep 2025
465 points (100.0% liked)

Programmer Humor

27237 readers
804 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS