Mateusz Loskot :: hacking on, working out, living up


25 Jun 2009 | mloskot

My wife asked me: Buy sausages, if you’ll find eggs, buy 10. What happens next?

Option #1:

<code>if eggs >= 10 then buy(sausages, eggs=10);</code>

Option #2:

<code>if sausages > 0 then buy(sausages);
if eggs >= 10 then buy(eggs, 10);</code>

Option #3

if eggs >= 10 then buy(eggs, 10);</code>

The 3rd option is dangerous one because it could end up with never-ending run in the city looking for sausages, never buying eggs and never coming back home.

…and more. Why?

Asking me to make shopping, my wife did not stick to the principles of valid inference and correct reasoning. That’s the reason why not everybody can be a programmer :-)

Fork me on GitHub