There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

The oldest joke in programming history

A women sent her kid that was into programming to the grocery store and told it:

“Please buy 1 bottle of milk if they have eggs buy 2”

The kid returned with just 2 bottles of milk. When it’s mom ask why it bought 2 bottles of milk, the kid said:

“Because they had eggs”

… Was the kid right?

kylxbn ,
@kylxbn@iusearchlinux.fyi avatar

For a serious reoly, I think the expression “If they have eggs, buy two” is redundant. If they didn’t have eggs, the kid just can’t and won’t buy any eggs.

I think the proper command would be, “Please buy 1 bottle of milk and two eggs.” That way, the kid won’t be confused and it’s still a proper valid command.

Unfortunately though, the sentence is ambiguous even to non-programmers. It is unknown whether the if condition applies to

  • buying two eggs (buy two eggs)
  • buying two bottles of milk (buy two bottles instead)
  • or buying a bottle of milk (buy another bottle)

Simply because they didn’t specify which to buy.

For a non-serious reply,


<span style="color:#323232;">cart.add(supermarket.takeProduct(ProductType.milk, 1));
</span><span style="color:#323232;">
</span><span style="color:#323232;">if (supermarket.getProduct(type: ProductType.eggs).length > 0) {
</span><span style="color:#323232;">    cart.add(supermarket.takeProduct(Product type.milk, 2));
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">cart.checkout();
</span>

The kid should have bought a total of 3 bottles.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines