The document describes three logical operators - AND (&&), OR (||), and NOT (!) - and provides examples of how each works using Boolean variables A (true) and B (false). The AND operator returns true only if both operands are non-zero, the OR operator returns true if either operand is non-zero, and the NOT operator reverses the logical state of its single operand.
The document describes three logical operators - AND (&&), OR (||), and NOT (!) - and provides examples of how each works using Boolean variables A (true) and B (false). The AND operator returns true only if both operands are non-zero, the OR operator returns true if either operand is non-zero, and the NOT operator reverses the logical state of its single operand.
The document describes three logical operators - AND (&&), OR (||), and NOT (!) - and provides examples of how each works using Boolean variables A (true) and B (false). The AND operator returns true only if both operands are non-zero, the OR operator returns true if either operand is non-zero, and the NOT operator reverses the logical state of its single operand.
Assume Boolean variables A holds true and variable B holds false, then: Show Examples Operator Description Example && Called Logical AND operator. If both the operands are non-zero, then the condition becomes true. (A && B) is false. || Called Logical OR Operator. If any of the two operands are non-zero, then the condition becomes true. (A || B) is true. ! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. !(A && B) is true.