Expressions — Operators and precedence |
C-471 04-01 You can use arithmetic, logical, and other Java operators in expressions.
This table lists operators that you can use in expressions. Operator precedence and associativity follow Java conventions (because the expressions are translated into Java for evaluation by the Java Virtual Machine). The table shows the precedence and associativity of each operator, from highest to lowest. Within each group, operators are evaluated left to right.
Precedence |
Associativity |
Operator |
15 |
Left |
(FunctionCall) |
14 |
Right |
+, - (unary), ! (not) |
12 |
Left |
*, /, % |
11 |
Left |
+, - (binary) |
9 |
Left |
<, >, <=, >= |
8 |
Left |
==, = (comparison), !=, <>, ^=, ~= |
4 |
Left |
&& (and) |
3 |
Left |
|| (inclusive or) |
2 |
Right |
?: |
1 |
Right |
= (assignment), +=, -=, /=, *=, %= |
(Gaps in the precedence numbers are reserved.) Java operators not listed in the table may not be used in PRPC expressions.
PRPC expressions follow Java conventions — equality and inequality operators have lower precedence than greater than and less than operators.
Assignment operators (including =
and +=
) are permitted as leftmost element in an expression, for example in the Property-Set method.
The operator ==
performs a String comparison using Java equals()
, while the operator ~=
performs a string comparison using Java equalsIgnoreCase()
. If the operator ~=
is used with any other data type, it is equivalent to ==
.