Logical operators

Last updated 3 months ago


The inversion operator (!) returns true if the operand is false, and false if the operand is true:


!true //false
!false //true

Logical and

The and or && expression determines if two values are both true. It returns true if both values are true and false otherwise:


true && false // false
true and true // true

Logical or

The or or ||expression determines if either of the values (or both) are true. It returns true if one (or both) of the values are true.


false or false // false
true || false // true