Bro supports three logical operators:
&&,
||,
and !
are Boolean “and,” “or,” and “not,” respectively.
&& and || are “short circuit” operators, as in C:
they evaluate their right-hand operand
only if needed.
The && operator returns F if its
first operand evaluates to false, otherwise it evaluates its second
operand and returns T if it evaluates to true.
The || operator evaluates its first operand and returns T if
the operand evaluates to true. Otherwise it evaluates its second
operand, and returns T if it is true, F if false.
The unary !
operator returns the boolean negation of its argument.
So, ! T yields F, and ! F yields T.
The logical operators are left-associative.
The !
operator has very high precedence, the same as unary + and -;
see
The || operator has
precedence just below &&, which in turn is just below that of
the comparison operators (see Comparison Operators).