-1

What is the English equivalent of boolean-OR, which conveys the meaning of "either of the options or both", as opposed to XOR, which conveys the meaning of "strictly one or the other"?

"Either or both" seems right, but still seems awkward. The answer should be easily understood by a non-programmer.

4

10 Answers 10

5

English uses or for both XOR and OR. It is up to context to determine which the user means. If you need to be precise, then you need to add words to be precise. Common English has no such need to compress it down to one word for each.

3

I believe people answering that the boolean 'OR' is understood as the English version is mildly wrong, and that the English version of OR is rather seen as the boolean 'XOR'.

Take the apple or the pear.

Surely if you take both the apple and the pear, the person asking the question would either raise an eyebrown or frown at your logical, technical correctness.

I think the easiest way to convey what you're meaning would be:

Exclusive:

Take either the apple or the pear.

Inclusive:

Take the apple and/or the pear.

2
  • 1
    I don't agree that or only means XOR in spoken English.
    – Oldcat
    Apr 15, 2014 at 22:54
  • So then answer the following Yes/No questions: Do you have the name Andreas or Scherman? Does President Obama have a wife or children? Is San Francisco or Los Angeles in California? Is the number 3 even or prime? If you can honestly answer No to all these questions, then you are correct that the common “or” in English is XOR. Apr 16, 2014 at 6:31
1

I would say that "a OR b" means "at least one of a, b is true"

1

a || b could be written “a and/or b”, which is short and avoids repetition, but is less clear in speech.

1

One could use the phrase "and/or" (wikipedia) which describes this logical structure. Note that it is considered ugly by many English usage style guides (the legal commentaries on "and/or" are quite amusing from the wikipedia link).

Wikipedia's style guide suggests "a or b, or both" for this logical structure.

a || b can also be read of "at least one of a or b" which has a reasonable flow to the phrase. This covers the "one must be true, but both may be true too" case with only slight awkwardness and doesn't encumber the reader with trying to figure out what is the correct interpretation of the logical structure that the "a or b, or both" (there are two 'or' statements in there that can require pause to think about what is meant).

The "at least one of ..." phrasing also makes it easy to adapt to the n-ary or statement such as a || b || c || d which can then be written as "at least one of a, b, c, or d."

Note that these logic to English translations really only work well when the logical statement is not too complex. Trying to transcribe (a && b) || c || (d && e) into text leads to a complex statement that doesn't have a clean idiomatic phrase in English.

2
  • “At least one of a or b” sounds somehow off to me. ‘One of’ doesn’t sit well with only two options mentioned, euphonically. I’d find it more natural to say “either or both a and b”. I have no such problems with “at least one of a, b, or c”, though. Apr 15, 2014 at 22:44
  • @JanusBahsJacquet one of the difficulties that I have when using multiple boolean conjunctions in describing a single boolean operation is the "wait a moment, I have to parse this" pause as a listener. Trying to minimize that 'what is actually being said' processing time I believe is simplest with the 'at least one of a or b' approach - the 'at least one of' clues you in to expecting a list of items and then you are given the very sort list of 'a or b'. That said, I don't find it ideal, but rather acceptable.
    – user40348
    Apr 15, 2014 at 22:50
1

The equivalent of the Boolean or is "or":

If it stops raining or the dog barks, then please walk the dog.

In this sentence, "or" has the same meaning as the boolean operator.

There are other uses of "or" that have a different meaning:

Would you like red or white wine?

I am going to France or England this summer.

0

I guess it depends on the audience.... I'd probably say "A or B, or both A and B".

0

A boolean OR function accepts two boolean values as input, and returns a boolean value of 1 (or true) if either or both of the inputs is 1, and 0 (or false) otherwise.

0

I would say "A or B" in normal conversation, and "A or B or both" in the rare circumstances when the difference is important.

0

The equivalent of boolean or in english is "at least one". For example suppose we have "condition 1" and "condition 2" while evaluating boolean or, then the expression evaluates to success in following three scenarios- 1)if "condition 1" is valid 2)if "condition 2" is valid 3)if both "condition 1" and "condition 2" are valid

Only when both of "condition 1" and "condition 2" are invalid, the expression evaluates to failure. Clearly, boolean or is "at least one".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.