%EVAL()

The %EVAL text macro function evaluates an arithmetic expression, and replaces the invocation by the result as a number.

The expression syntax is as usual, bilaeral operators stay between values, unilaeral operaetors stay before the values, the parentheses affect the order of operations. Value can be integer numbers and the names of system variables. The text macro processing is active during the expression evaluation, so you can invoke text macros inside of expressions, and you can use text macro functions (for example, %PICEX() ) in the expressions too.

Both arithmetic, logical and boolean operators are available for using in the expressions. The boolean values are represented by numerical values: When a boolean value is created by an operator or function:

When a boolean value is assumed by a boolean opeerator:

Do not be confused, the expressions have both logical and boolean operators:

Operator types
Code Meaning
B Boolean operator, inputs treated as boolean, produces 0 or 1
L Logical (Bitwise) operator, inputs are integers, produces integer
C Comparison, inputs are integers, produces 0 or 1
A Arithmetic operator, inputs are integers, produces integer

Bilateral Operators
Symbol Operator precedence Type Meaning
| 1 L Bitwise OR
|| 1 B Boolean OR
& 2 L Bitwise AND
&& 2 B Boolean AND
< 3 C Less, then
<= 3 C Less or equal
= 3 C Equal
== 3 C Equal
!= 3 C Not equal
> 3 C Greater
>= 3 C Greated or equal
+ 4 A Addition
- 4 A Substraction
* 5 A Multiplication
/ 5 A Integer division

Unilateral operators
Symbol Type Meaning
+ A Does nothing (plus)
- A Minus
! B Not - returns 0, if the value following it is not zero, 1 otherwise