Table Of Contents

Expression Operator Precedence

Last Modified: June 10, 2021

Operators in real-time sequence expressions have an order to when they execute.

The following table lists the order of precedence for operators from highest to lowest. Operators on the same line have the same precedence.

Operator Description
** Exponentiation
-, !, ~, ++, and –– Unary negation, logical not, bit complement, pre- and post-increment, pre- and post-decrement
*, /, % Multiplication, division, modulus (remainder)
+ and – Addition and subtraction
>> and << Arithmetic shift right and shift left
>, <, >=, and <= Greater, less, greater or equal, and less or equal
!= and == Inequality and equality
& Bit and
^ Bit exclusive or
| Bit or
&& Logical and
|| Logical or
? : Conditional evaluation
= op= Assignment, shortcut operate and assignop can be +, –, *, /, >>, <<, &, ^, |, %, or **.

The assignment operator = is right associative (groups right to left), as is the exponentiation operator **. All other binary operators are left associative.

The numeric value of TRUE is 1, and FALSE is 0 for output. The logical value of 0 is FALSE, and any nonzero number is TRUE. The logical value of the conditional expression
<lexpr> ? <texpr>: <fexpr>
is <texpr> if the logical value of <lexpr> is TRUE and <fexpr> otherwise.

Recently Viewed Topics