Purpose of this chapter.
We will learn about the logical AND operator.
Operators of the 7th group.
Operators of the 7th group are following.
|&||x & y||logical AND operator|
This is a logical operator with high priority.
logical AND operator
Logical AND operator is an operator for performing logical AND operation on the left and right operands of operator. The operand must be an instance of the bool class.
The class of the result is a bool class.
Let's execute a logical AND operation as an example.
bool result0 = true & true; // The result is true;
bool result1 = true & false; // The result is false;
bool result2 = false & true; // The result is false;
bool result3 = false & false; // The result is false;
The operands of the logical AND operator must be a bool class. If you apply logical AND operator to other classes, an exception will be thrown.
Please see other resources for details of logical operations.