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".
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".
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 === 6notx = 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.
Now just how did he procure the rest of the 5, is a mystery.