I had a conversation with Aviad several days ago as to how a logical *xor* operation could be described in a sentence. Just yesterday, I had the same conversation with a co-worker.

First, we looked at what each logical operation performs:

- a
*and*b – only true both operands are true. - a
*or*b – true when either one of the operands is true. - a
*xor*b – true when only one of the operands is true. *not*a – true when the operand is false.

Then we looked at how we can describe the *xor* operation with other logical operations:

a xor b = (a and not b) or (b and not a)

And then we looked at how we can describe the *or* operation with other logical operations:

a or b = (a xor b) xor (a and b)

Now, let’s think verbally for a minute. We can agree that the logical *and* and *not* operations are what they mean.

But what does the word ‘or’ mean? What if I asked you for ‘apples or oranges’? Am I asking you to give me apples, oranges or both?

The answer is that it means I want either one, but not both.

So a verbal ‘or’ is really a logical *xor*? Yes! They mean exactly the same – *a xor b* meansÂ ‘a or b’.

Up until now, we’ve seen that the following translations can be made:

*a and b*=> ‘a and b’.*a xor b*=> ‘a or b’.*not a*=> ‘not a’ (= ‘the opposite of a’).

All that’s left is translating the logical *or*.

Let’s go back to the original formula:

a or b = (a xor b) xor (a and b)

What we see here is that a logical *or* can be comprised of a logical *xor* and logical *and* expressions. Let’s take the verbal expressions and place them instead of the logical ones:

a or b= " 'a or b' or 'a and b' "

Let’s compact it a bit:

a or b= 'a and/or b'

And there you have it.

I, as a programmer, was used to using ‘or’ in my verbal algorithm descriptions, but only now am I aware of the duplicity.

I hope you too can take something away from this :)