this post was submitted on 13 Jan 2026
81 points (88.6% liked)

Programmer Humor

28409 readers
1425 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
 

A wife tells her programmer husband: β€œGo to the store and buy a gallon of milk. If they have eggs, get six.”

He comes back with six gallons of milk. When she asks why, he replies: β€œThey had eggs".

top 26 comments
sorted by: hot top controversial new old
[–] CanadaPlus@lemmy.sdf.org 4 points 10 hours ago* (last edited 9 hours ago)

Skill issue. Used an implied "of them", which is idiomatic in the language, but forgot to update the value of "them" first. Without that, taking the first value is compliant with the standard.

/s, but only if we assume us programmers have common sense. ^/s^

[–] joyofpeanuts@beehaw.org 6 points 11 hours ago

He was not instructed to get back home. To this day he is stuck in the store.

[–] Shady_Shiroe@lemmy.world 51 points 23 hours ago (1 children)

I like this joke better:

Wife asks her husband if he is too obsessed with his work and if he even he loves her anymore. He assures her that in a list of things he loves the most, she is number 1 on that list. She was satisfied with the answer.

[–] Australis13@fedia.io 16 points 22 hours ago (2 children)

He's safe if he works in MATLAB or other languages that use one-based indexing. He's a dead man if she works out most lists are zero-based.

[–] lambipapp@lemmy.world 11 points 17 hours ago

I work in Lua. I always start my tables on 'dinosaur'

[–] ulterno@programming.dev 2 points 17 hours ago

He'll make sure until death that his wife doesn't figure that out.

[–] eager_eagle@lemmy.world 13 points 1 day ago (2 children)

people really overthinking the joke in the comments huh

[–] NaibofTabr@infosec.pub 7 points 20 hours ago (1 children)

I mean... do you know what community you're in right now?

[–] eager_eagle@lemmy.world 3 points 14 hours ago

my bad, I thought this was a wendy's

[–] Feyd@programming.dev 6 points 23 hours ago (1 children)

People having seen the exact same joke that isn't even good for a decade or more....

[–] eager_eagle@lemmy.world 9 points 23 hours ago (2 children)
[–] jve@lemmy.world 2 points 19 hours ago (1 children)

I hate the fucking eagles, man.

[–] zebidiah@lemmy.ca 1 points 11 hours ago

Fuck you man. If you don't like my fuckin' music get your own fuckin' cab!

[–] Feyd@programming.dev -1 points 23 hours ago (1 children)

That's cute, but you're complaining about people expressing their opinions on a platform where the entire point is to comment on posts...

[–] eager_eagle@lemmy.world 3 points 23 hours ago (1 children)

I'm not complaining, I'm stating an observation. You seem the one bothered

[–] ulterno@programming.dev -1 points 17 hours ago

You seem the one bothered

[–] Feyd@programming.dev 10 points 1 day ago (4 children)

I've never liked this joke. I guess it's supposed to be that the husband does the literal action as described, but instead it's just that they interpreted ambiguity opposite than expected? It just really doesn't work very well :/

[–] rockerface@lemmy.cafe 40 points 1 day ago (2 children)

The joke is bad because the husband is supposed to bring seven gallons of milk. Since the egg condition is checked after he already got one.

[–] NaibofTabr@infosec.pub 12 points 20 hours ago* (last edited 20 hours ago) (1 children)

No no, the imperative "get six" overrides the previous "buy a gallon of milk" if the "they have eggs" condition is met.

"get six" implies x === 6 not x = x + 6, that would be "get six more"

The real problem is that "buy" was only specified in the first case. Because the conditional was met, he should get six gallons of milk but not buy them.

[–] ulterno@programming.dev 3 points 17 hours ago

Now just how did he procure the rest of the 5, is a mystery.

Omg, you’re so right. I didn’t read it that way until you pointed that out.

[–] jbrains@sh.itjust.works 3 points 23 hours ago (1 children)

Given the stereotypical difficulty of "product folks" and programmers agreeing on and building shared understanding of what to build, this joke seems clear and straightforward. It works because of course, the customer and the programmer failed to agree on something simple.

That is why we have spec docs, duh. /s

[–] sping@lemmy.sdf.org 1 points 23 hours ago

I'm pretty sure I've heard effectively the same core joke but better composed. Can't remember it though because at best it's middling funny.

[–] dnick@sh.itjust.works -1 points 1 day ago (1 children)

Maybe it's just worse when written. The period at the end of the sentence makes it hard to see how it could be misunderstood.

To your point though, not sure if I'm aware of any programming language that would continue a statement with a following if block. Far more likely that it would fail due to lack of an element to apply the 6 to rather than having a pointer to the previous object, or he would try getting what ever the literal version of a 6 would be, or maybe some slang version.

[–] ignirtoq@feddit.online 2 points 23 hours ago

Python, though the logic would be backwards:

milk_gallons = 6 if eggs > 0 else 1