Boolean
A truth or false value.
true
or false
a & b
a
and
b
are true. Otherwise it evaluates to false.
a | b
a
and b
are true. Otherwise it
evaluates to false.
!a
a
is
false, otherwise it evaluates to false. This operator has
higher precedence than either of the binary operators.
It's true.
.
if(true) { print "It's true.\n" }The second example shows how a boolean expression can be used to test a number of conditions at once. It also shows how parentheses can be used to force a particular logical order of evaluation. The example halts script execution for at least a minute. Thereafter the script will continue if a user sends a quit signal or the time reaches 03:44 LST.
until $elapsed >= 1m & ($after_time(03:44,LST) | $signaled(quit))
!
operators have the highest precedence, so
they are applied to their operands first. Binary
&
and |
operators
both have equal precedence, so each is applied to the result of
the expression to its left and the next operand to its right.
For example, the following two expressions are equivalent:
until true | false & true | false & false until (((true | false) & true) | false) & falseIf in doubt, use parenthesis to force the desired ordering.