this post was submitted on 15 Jul 2025
270 points (94.1% liked)
Programmer Humor
25059 readers
710 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
After working at blizzard for 51 years, I finally found an elegant solution by using the power of recursion
Now see, you need the other method. IsNegativeEven()
We can avoid expensive branches (gasp) by using some bitwise arithmetic to achieve the so-called "absolute value", an advanced hacker technique I learnt at Blizzard. Also unlike c, c# is not enlightened enough to understand that my code is perfect so it complains about "not all code paths returning a value".
Nice, now we just need another function to find odd numbers, cause not all numbers are even you know.
I removed the tail recursion for you:
What'd be the result for
IsEven(1)
?Stack overflow
I didn't get this.
Why return
book
? Does that have some Blizzard reference?And why would
number == 2
⇒return false
? This is a function for gettingtrue
when the number is even, right?Haha, you're right. I've now learned two things:
At the end of the day i just wanted the function to be worse, by causing stack overflows