this post was submitted on 15 Jul 2025
149 points (95.2% liked)

Programmer Humor

25009 readers
1176 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
[โ€“] sus@programming.dev 29 points 10 hours ago* (last edited 10 hours ago) (4 children)

After working at blizzard for 51 years, I finally found an elegant solution by using the power of recursion

private bool IsEven(int number){
  if (number > 1) return IsEven(number - 2);
  if (number == 0) return true;
  if (number == 1) return false;
}
[โ€“] elvith@feddit.org 13 points 9 hours ago
assert IsEven(-2);
load more comments (3 replies)