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".

you are viewing a single comment's thread
view the rest of the comments
[–] 7 points 8 months ago (2 children)

Python, though the logic would be backwards:

milk_gallons = 6 if eggs > 0 else 1
  • source
  • parent
  • hideshow 2 child comments
  • [–] 0 points 8 months ago (1 child)

    Right, it would be started basically exactly the opposite. Certainly not a statement followed by an if block.

  • source
  • parent
  • hideshow 1 child comment