For doing arithmetic, Bro supports
+
-
*
/
and
%
.
In general, binary operators evaluate their operands after converting them
to the higher type of the two and return a result of that type.
However, subtraction of two count
values yields an int
value.
Division is integral if its operands are count
and/or int
.
+
and -
can also be used as unary operators. If applied to a count
type,
they yield an int
type.
%
computes a modulus, defined in the same way as in
the C language. It can only be applied to count
or int
types, and yields count
if both operands are count
types,
otherwise int
.
Binary +
and -
have the lowest precedence, *
, /
, and %
have equal
and next highest precedence. The unary
+
and -
operators have the same precedence as the !
operator Logical Operators.
See , for a table of the precedence of all Bro
operators.