[Tutor] 'or' in assignment (not if statement)?
steve at pearwood.info
Sun Dec 12 03:56:33 CET 2010
Lie Ryan wrote:
> The question "Would you like Italian or Chinese for dinner" is actually
> a contraction of "Would you like Italian for dinner or would you like
> Chinese for dinner". If we ask these two questions separately to the
> wife, we get either "Yes or Yes", "Yes or No", "No or Yes", or "No or
> No", which evaluates to either "Yes", "Yes", "Yes", and "No" (use "True"
> or "False", if you prefer). Or syntactically:
In natural language (at least in English, other languages may have other
conventions), "or" generally has a meaning closer to exclusive-or (xor)
than to the logical disjunction (boolean "or"):
"We can go out, or we can stay home."
"Take the money, or the box."
"You must find the defendant guilty or not guilty."
"The cat is either inside the box, or outside the box."
"Your money, or your life."
You can't do both at the same time.
Even when the two alternatives aren't strictly contradictory, it's often
assumed that only one will hold:
"Would you like tea or coffee?"
It would be surprising if somebody wanted both.
(Particularly if they were served in the same cup -- my wife once
ordered a chai latte at a cafe. The waiter had no idea what that was,
but must have known that "chai" means tea, and so mixed tea and coffee
in the same cup and served it with milk. And yes, the result was as
horrible as it sounds.)
We often make inclusivity an explicit choice:
"Dinner, or a movie, or both?"
Quoting from Websters Dictionary :
A particle that marks an alternative; as, you may read or may
write, -- that is, you may do one of the things at your
pleasure, but not both. It corresponds to either. You may
ride either to London or to Windsor. It often connects a
series of words or propositions, presenting a choice of
either; as, he may study law, or medicine, or divinity, or he
may enter into trade.
Having said that, "or" in natural language is not precisely logical-xor
either. I can't think of any natural question "would you like A or B?"
where the answer "No" is appropriate if you would like both. Natural
language is also far more flexible, and frequently allows choices that
aren't explicitly enumerated:
Waiter: "Tea or coffee?"
Person A: "Nothing for me."
Person B: "Hot chocolate please."
Steve Martin: "I'll have a tall fair-trade organic half double-decaf
half caf low-fat soy latte with a twist of lemon."
The reality is, there's no one-to-one correspondence between natural
language constructs and boolean algebra.
More information about the Tutor