8 ms·
"Go the store and pick up a jug of milk. If they have eggs, get a dozen." Programmer returns home with 13 jugs of milk
by bentcorner 14y ago
"Go the store and pick up a jug of milk. If they have eggs, get a dozen."
Programmer returns home with 13 jugs of milk
- groby_b 14y agoSeriously? An ancient programming joke, with a gratuitous off-by-one error?
- chimeracoder 14y agoIt's not gratuitous. One jug + one dozen = 13 jugs.
- mbatanian 14y agojugs = 1; if (have eggs) { jugs = 12; } Get a dozen, not a dozen more.
- T-hawk 14y agocart.addJugs(1); if (haveEggs) cart.addJugs(12); Now the cart has 13 jugs.
- wlesieutre 14y agoI'd say that "get a dozen" implies "jugs = 12" and not "jugs += 12". If you wanted to get a dozen more, you'd say "get a dozen more"
- pash 14y agoThis is why we don't program in English.
- fnordfnordfnord 14y agoAnd why it is so hard to write a good specification.
- AndrewDucker 14y ago"get a dozen" implies "jugs += 12"