Expression Operators

Templex follows the standard mathematical order of operations when an expression is evaluated.

Expressions can contain constants, variables, unary or binary operators, and mathematical or string manipulating functions.

The following table outlines the operators in order of precedence (highest to lowest), with those of equal precedence grouped together:
Symbol Operation Associativity
() Function argument, parenthesis left to right
! Logical NOT right to left
+ Plus (unary +)
- Minus
^ Raise to power right to left
* Multiply left to right
/ Divide
% Modulus
+ Add left to right
- Subtract
< Less than left to right
> Greater than
<= Less than or equal to
>= Greater than or equal to
== Equal to left to right
!= Not equal to
&& Logical AND left to right
|| Logical OR left to right
Parentheses can be nested to any depth in an expression. The following are examples of legal expressions:
sqrt(x1^2 + x2^2) - 2 * rate^2
-abs(sin((dtor(-theta))/(2+x))^3)
!((answer == "Y") && (wheelbase >= 9))