Data Type - Boolean


A boolean type contains one of two values either TRUE or FALSE

Logical operators

Operator Description Results
&& Logical "and" returns true when both operands are true, otherwise it returns false
|| Logical "or" returns true if either operand is true. It only returns false when both operands are false
! Logical "not" returns true if the operand is false and false if the operand is true. This is a unary operator and precedes the operand.

Logical operators

Operator Description
== Returns true if the operands are equal
!= Returns true if the operands are not equal
> Returns true if the left operand is greater than the right operand
< Returns true if the left operand is less than the right operand
>= Returns true if the left operand is greater than or equal to the right operand
<= Returns true if the left operand is less than or equal to the right operand

Back