Purpose of this chapter.
We will learn about the logical OR operator.
Operators of the 8th group.
Operators of the 7th group are following.
||||x | y||logical OR operator|
This is a logical operator with low priority.
logical OR operator
Logical OR operator is an operator for performing logical OR 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 OR operation as an example.
bool result0 = true | true; // The result is true;
bool result1 = true | false; // The result is true;
bool result2 = false | true; // The result is true;
bool result3 = false | false; // The result is false;
The operands of the logical OR operator must be a bool class. If you apply logical OR operator to other classes, an exception will be thrown.
Please see other resources for details of logical operations.