I have come across the following code:
const bool isIntersect = ...;
const bool isReversed = ...
if(!isIntersect != isReversed) {
//some stuff
}
It is very weird for me. The question is can be it written in more clear way:
So seems it is not as !isIntersect || isIntersect
nor !isIntersect && isIntersect
.
Let's draw a truth table:
isIntersect isReversed outcome
false false true
false true false
true false false
true true true
As we can see, it's just an equivalence:
isIntersect == isReversed
So you can simplify the code into
if (isIntersect == isReversed) {
// some stuff
}