this post was submitted on 15 Jul 2025
266 points (94.0% liked)

Programmer Humor

25059 readers
889 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] Ebber@lemmings.world 12 points 2 days ago (2 children)

I removed the tail recursion for you:

private book IsEven(int number) {
    if(number > 1) return IsEven(number - 2) == true;
    if(number == 0) return true; 
    if(number == 2) return false;
}
[–] Ferk@programming.dev 3 points 8 hours ago (1 children)

What'd be the result for IsEven(1)?

[–] Ebber@lemmings.world 5 points 8 hours ago

Stack overflow

[–] ulterno@programming.dev 3 points 1 day ago (1 children)

I didn't get this.

Why return book? Does that have some Blizzard reference?
And why would number == 2return false? This is a function for getting true when the number is even, right?

[–] Ebber@lemmings.world 11 points 1 day ago* (last edited 1 day ago)

Haha, you're right. I've now learned two things:

  1. I should not write code on a mobile
  2. I should not become a proof reader

At the end of the day i just wanted the function to be worse, by causing stack overflows