That's debatable. It's impossible for me to say "if" in any context without thinking about programming now. I can't help it.
That's debatable. It's impossible for me to say "if" in any context without thinking about programming now. I can't help it.
When I was a younger programmer (as in, during the first few years), I discovered that assuming boolean / formal logic meanings for {if, or, else, and} in communication with my spouse (art + sales, and very smart, though not a programmer or trained in symbolic logic) resulted in, shall we say ... miscommunication. So I had some unintended help in building the separate registers of meaning / communication. :-)
Building separate meaning registers for communication does take some time.
I cringe every time I hear the and/or thing translated to Spanish, usually several times in a row.
Not sure if it's the usual mistranslation or it's also idiotic in the original text.
But "or" in English doesn't always mean xor in code. Sometimes it is the same as or in code.
There exist languages which lack this ambiguity. Latin has two different words for "or" – "vel" (inclusive) and "aut" (exclusive).
1: do you think it's A or do you think it's not A? 2: yes (assigning a truth value to the or expression rather than indicating which or operand is true.)
"Do you want /pizza or a \burger\?" = XOR
"Do you want /pizza or a /burger/? = OR (as in programming)
It can make a good (though well-worn) joke to answer the XOR version with "Yes."
“Or” in English can mean either exclusive-or or inclusive-or (usually it means the latter), and/or is a means to specify inclusive-or without ambiguity (the parallel construct for exclusive-or is “X or Y, but not both”) used mostly in contexts where misconstruction can be exotics to the drafter of the text, such as contracts and formal policy documents.
In code, the meaning is already unambiguous; in all languages I am aware, “or” or the symbol referred to in speech with that name (e.g., “||”) is strictly inclusive, and do there is an exclusive-or operator, it is different.
But in type system the disjunction concept represents 'either', the concepts are more like how people refer to 'or'.
I can't think of any where that's true; logical “and” and “or” are usually exactly what they claim to be, and many languages implement both as short-circuiting operators, whereas XOR can't short circuit because you can never know the result without considering both arguments.
Programmer's spouse: Honey, go to the shops and buy 1 bottle of milk, if they have eggs buy 6.
Programmer brings home 6 bottles of milk.