this post was submitted on 13 Jun 2023
26 points (100.0% liked)

Programmer Humor

19548 readers
1071 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 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] lowleveldata@programming.dev 3 points 1 year ago* (last edited 1 year ago)

Good solution! I think you should show the last 3 lines that makes it work tho. FIFY:

private bool IsEven(int number){
    if (number == 1) return false;
    else if (number == 2) return true;
    else if (number == 0) return true;
    else if (number == -1) return false;
    else return !IsEven(abs(number) - 1);
}