# Does this behavior have a formal name, and if so, what is it?

This is related to the issue asked about in this other question.

For the sake of this question, let's assume that we have a variable v that can have any value from the set of values

"a", "b", "c", ..., "z"

In this case then the programmers wants to have specific code executed when the value of v is not "x", "y", or "z".

So the following IF statement is constructed:

if (v != "x" || v != "y" || v != "z") {//do something}

Above statement would always return true, due to that the 3 conditions using negation are checked independently of each other.

Consequently, at any given time, any single one of the 3 conditions can evaluate to TRUE, leading to the entire IF statement evaluating to TRUE.

Anyway so the question I wanted to ask is, does this behavior or situation have a formal name, and if so, what is it?

• I don't understand your question. In all programming languages, the if statement you give is true, since v can't be simultaneously equal to three different things so it's guaranteed that at least two of the conditions are true. And Boolean OR by definition evaluates to true if at least one of its arguments is true. So I'm not sure what behaviour you're talking about. – David Richerby Aug 18 '17 at 19:55
• And the condition that's normally expressed as "not "x", "y" or "z"" would be written !(v=="x" || v=="y" || v=="z") – David Richerby Aug 18 '17 at 20:23

It returns true not just due to "that the 3 conditions using negation are checked independently of each other", but because the expression (v != "x" || v != "y" || v != "z") is always necessarily true. In logic such expressions are called tautology, i.e. a formula that is true in every possible interpretation (Wikipedia).