Operator Overview

4Test Expressions

Each 4Test expression is made up of operators and operands.

  • An operator specifies what operation to perform on its operand(s).
  • An operand can be a literal value, constant, identifier, or another expression (such as a function call).

Default Order of Precedence

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

Overriding Precedence with Parentheses

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)