Logical operators are used to combine two expressions into logical expressions. There are three logical operators:
The AND operator (&&) operator results in true if both expressions are true; it results in false if either one is false.
The OR operator (||) results in true if either of the expressions are true; it results in false only if both expressions are false.
The NOT operator (!) results in true only if the expression itself evaluates to false; it results in false only if the expression evaluates to true.
The following is an example of using logical operators.