The Programmer's Wife

I was thinking the other day about one of my favorite programmer jokes.  The exact wording varies but it goes essentially like this:

"A programmer's wife sends him out to the grocery store.  She says to him, 'Get a loaf of bread, and if they have eggs, get a dozen.'  The programmer returns home with 12 loaves of bread."

But I caught myself thinking...'wait, would it maybe be 13 loaves of bread instead, the first one PLUS the dozen he got when it turned out that the store had eggs?'  And my brain actually wandered off on a bit of a tangent with that....

BRAIN:  "well, it depends on whether the variable is being reassigned or appended....is it

bread = 1

bread = 12 if store_has_eggs

which would make it 12, or is it

bread = 0;

bread += 1

bread += 12 if store_has_eggs

which would make it 13?  What if the joke was just 'Get a loaf of bread. If they have eggs, get a dozen.'  Does the 'and' the entire statement a boolean?  How about

Def get_bread(num)

@bread += 1

end

 

store_has_eggs = 10000

@bread = 0

get_bread(1) and (get_bread(12) if eggs_in_store)

?

And so on and so on.  Yup, I spent actual time thinking about this.

The kicker: I decided to Google it to see if anyone else had thought about this little details.  Turned out there was a Reddit thread - correction, multiple Reddit threads over the course of the last few years - where the comment section was filled with programmers nitpicking the details of the joke and contributing variations on it.  Yup, they spent actual time thinking about and debating this.  Because of COURSE they would.

I love programmers.