When more than one operation occurs in an expression they are normally performed from left to right. However, there are several rules.
Operators from the arithmetic group are evaluated first, then concatenation, comparison and finally logical operators.
This is the set order in which operators occur (operators in brackets have the same precedence).
^,-,(*,/),\,Mod,(+,-),
&,
=,<>,<,>,<=,>=,Is,
Not, And, Or, Xor, Eqv, Imp
This order can be overridden by using parentheses. Operations in parentheses are evaluated before operations outside the parentheses, but inside the parentheses, the normal precedence rules apply.
If we look at two statements:
A = 5+6+7+8
A = (5+6) * (7+8)
According to operator precedence, multiplication is preferred before addition, so the top line gives A the value 55. By adding parentheses, we force additions to be evaluated first and A becomes equal to 165.
First