Boolean
Boolean is a logical data type which can either be true or false.
Operators
Logical operators
Operator | Description | Example |
---|---|---|
and | Conjunction | a == b |
or | Disjunction | a != b |
! | Negation | !a |
not | Negation, long form | not(a) |
Comparison operators
Operator | Description | Example |
---|---|---|
== | Equality | a == b |
!= | Inequality | a != b |
Ternary operator
It's possible to write a short in-line statement using ternary operator, if then else
.
product.price > 100 ? 'premium' : 'value'; // if price is greater than 100 "premium" otherwise "value"