Boolean Operators

There are three Boolean operators: And Or Not

You typically use these operators to combine expressions involving the comparison operators.

See Comparison Operators.

For example, the following expression returns true if the number represented by x is between 5 and 10.

x>=5&&x<=10

Like the comparison operators, every Boolean operator returns a Boolean value (true or false).

Boolean Operators

Operator Definition
Logical And x&&y Returns true only if both x and y are true.
Logical Or x
Logical Not !x Returns true if x is false. Otherwise, Not returns true.