Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.zip
programmer_humor·Programmer HumorbyRacerX

A software developer's wife asked him to get a gallon of milk from the store

"... and if they have eggs, get a dozen, " she added.

He later came home with 12 gallons of milk.

"Why'd you get so much milk!?!" his wife asked.

He replies, "THEY HAD EGGS!"

View original on lemmy.zip
137

26 replies

sh.itjust.works

Alternate version:

"While you're there, pick up some bread," she added. He never returned.

109
programming.dev

and when he returned empty-handed he answered "I then set the bread back down"

18
Oisteinkreply
lemmy.world

No - he was asked to bring 1 or 12, not 1 and 12

27
piefed.zip

Doesn't change it.

Wife adds 1 gallon of milk to shopping list;

Wife adds ( eggs, dozen) gallons of milk to shopping list;

Shopping list has 1 gallon and a dozen gallons for a total of 13 gallons.

7

The shopping list doesn’t need to be additive, that’s just one way of interpreting what the wife wrote. There is no one correct way to read a joke as a program (my whole point), that is unless you write an interpreter for jokes :P

function getGallonOfMilk() {
  return 1;
}

function getDozen() {
  return 12;
}

const hasEggs = store.checkInventory(“eggs”);

const result = (
  getGallonOfMilk(),
  hasEggs && getDozen()
);

console.log(result * "🥛"); // 🥛🥛🥛🥛🥛🥛🥛🥛🥛🥛🥛🥛
10

1 gallon. If they have eggs, get a dozen.

If you take that as anything other than a dozen gallons, ie 12 gallons, you’re wrong.

0
HairyHarryreply
lemmy.world

Aahh, the ol' botox lips, raised monobrow, grumpy face and the two toothed irony wiking emoticons.

12

What? They apparently had eggs. If, then, else.

8
programming.dev

I still don't understand why he managed to get 12 gallons and not 11 or even 10.

2
lemmy.today

So get a gallon of milk, and IF they have eggs, get a dozen (gallons of milk). Basically this is an if statement meaning if X is true, do this. Well normally we think get a dozen would be get 12 eggs, but because "have eggs = true" that meant get 12 gallons of milk. The opposite would've been eggs=false and he'd come home with 1 gallon.

I'm not a Dev so I can't write the code better, but I understand the language enough

14
AlteEreply
programming.dev

Ahh, my bad. I forgot that in English dozen means 12 but dosens means 10*n with n > 1.

6

You reached the end