What are the commonly used Boolean logical operators?
There are four types of Boolean logical operators: and (logical AND), or (logical OR), not (logical NOT), and XOR (logical exclusive OR).
1. and (logical sum)
In life, logic and explanation are equivalent to "and". & calls a logical AND and the result is true only if both operands are true. & is called a concise AND or short-circuit, and if only two operands are true, the result is true.
2. or (logical OR)
If one or more operands are true, the logical OR operator returns the Boolean value true; only when all operands are false, the result It is false.
3. not (logical negation)
Logical negation is the reciprocal of the original value.
4. xor (logical exclusive OR)
If a and B are different, the exclusive or result is 1. If a and B are the same, exclusive or results in 0.
Extended information:
The origin of Boolean logical operators:
Boolean used mathematical methods to study logical problems and successfully established logical calculations. He used equality to represent judgment and regarded reasoning as the transformation of equality. The effectiveness of this transformation does not depend on people's interpretation of the symbols, but only on the combination rules of the symbols. This theory of logic is often called Boolean algebra.
In the 1930s, logic algebra was applied to circuit systems. Subsequently, with the development of electronic technology and computer technology, various complex large systems appeared, and their transformation laws also followed the laws revealed by Boolean operations.
The above is the detailed content of What are the commonly used Boolean logical operators?. For more information, please follow other related articles on the PHP Chinese website!