Precedence and associativity
If you combine several operands with different operators, the operator
precedence defines in which order BI# performs the operations. For example, BI#
interprets x + y * z
as x +
(y * z)
, because the operator *
has a
higher precedence than the operator +
.
This table lists all operators that are sorted by their precedence from the highest to the lowest:
Operators | Function |
---|---|
+ - !
|
Unary |
* / %
|
Multiplicative |
+ -
|
Additive |
< > <= >=
|
Relational |
== !=
|
Equality |
&
|
Binary AND |
^
|
Binary XOR |
|
|
Binary OR |
and
|
Logical AND |
or
|
Logical OR |
=
|
Assignment |
Associativity controls the order of operations, if you combine several operands
with the same operator. For example, BI# interprets x + y +
z
as (x + y) + z
, because the +
-operator is left-associative. At the moment all
operators in BI# are left-associative.
You can always change precedence and associativity, if you use parentheses as
in (x + y) * z
, for example.