Each 4Test expression is made up of operators and operands.
If you do not use parentheses to make explicit the order of precedence you want, Silk Test Classic evaluates your expressions according to the following table. The table lists the operators in order from highest to lowest precedence.
Operators | Order of evaluation |
---|---|
:: | Left to Right |
@ | Right to Left |
-> | Left to Right |
() [] . | Left to Right |
[type] ! ~ unary - unary + ++ - - | Right to Left |
* / % ** | Left to Right |
+ - | Left to Right |
<< >> | Left to Right |
< <= > >= | Left to Right |
== != | Left to Right |
& | Left to Right |
^ | Left to Right |
| | Left to Right |
&& | Left to Right |
|| | Left to Right |
? : | Left to Right |
To override the default order of precedence and tell the compiler exactly how you want it to group operators and operands, use parentheses. For example:
// Without parenthesis, multiplies a by 2, adds result to b a * 2 + b // With parenthesis, adds 2 to b, multiplies result by a a * (2 + b)