463
submitted 2 months ago by sirico@feddit.uk to c/programmerhumor@lemmy.ml
(page 2) 50 comments
sorted by: hot top controversial new old
[-] kreskin@lemmy.world 8 points 2 months ago

no unit tests huh.

/s

[-] ClathrateG@hexbear.net 7 points 2 months ago* (last edited 2 months ago)

apart from everything else, have they never heard of a switch statement

load more comments (1 replies)
[-] voodooattack@lemmy.world 7 points 2 months ago* (last edited 2 months ago)
bool isEven(int value) {
  return (int)(((double)value / 2.0) % 1.0) * 100) != 50;
} 
[-] Treczoks@lemmy.world 6 points 2 months ago

Good if you are rated by an AI that pays for LOCs.

[-] Kuma@lemmy.world 6 points 2 months ago

I am more amazed that he didn't stop at 10 and think "damn this is tiresome isn't there a one liner i could do?". I want to know how far he went. His stubbornness is amazing but also scary. I haven't seen this kind of code since back in school lol lol lol

[-] ICastFist@programming.dev 5 points 2 months ago

Oh shit, gotta check the negative numbers as well!

load more comments (1 replies)
[-] FunkyStuff@hexbear.net 5 points 2 months ago* (last edited 2 months ago)

Throwback to when someone shared the OG version of this meme to my uni chat, I replied with "Oh you can simply do

def is_even(n: int) -> boolean:
    if n > 0 return not is_even(n - 1)
    elif n < 0 return not is_even(n + 1)
    else return True

And instead of laughing at the joke the TA in the chat said "When you start getting internships you'll do n % 2" like I was being serious.

[-] FireIced@lemmy.super.ynh.fr 5 points 2 months ago

that's some good code right there

[-] Midnitte@beehaw.org 5 points 2 months ago

When did Thor become the dev for Yandere Simulator?

[-] keepcarrot@hexbear.net 4 points 2 months ago

I want to assess coders by lines written! The more the better!

[-] Packet@hexbear.net 4 points 2 months ago

The end user yearns for their machine to be utilized fully, so instead of that, you can import full deepseek model to do the task

[-] ferric_carcinization@lemmy.ml 4 points 2 months ago

I hope that the language's ints are at most 32 bits. For 8 bits it could even be written by hand & the source code for a 32 bit version would only take up avg_line_len * 4GiB space for the source code of the function. But it might take a bit of time to compile a version that supports the full range of 64 or 128 bit ints.

[-] segfault11@hexbear.net 6 points 2 months ago

all you have to to is throw an exception if the number is bigger than 100, who even needs numbers that big anyways?

load more comments (1 replies)
[-] last_philosopher@lemmy.world 4 points 2 months ago

To be fair, the question is "Write a function that simultaneously determines if the number is even and works as a timer"

load more comments (1 replies)
load more comments
view more: ‹ prev next ›
this post was submitted on 15 Jul 2025
463 points (94.8% liked)

Programmer Humor

38519 readers
658 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS