Dyadic operators

Formulae in ITP are calculated from left to right in case of operators with equal priority (left associative).

The ITP Model language knows the following dyadic operators:

Operator

Associativity

Operand types

Result type

Operation performed

+

Left

NUMBER

NUMBER

Addition

+

Left

TEXT

TEXT

Concatenation of operand texts

-

Left

NUMBER

NUMBER

Subtraction

*

Left

NUMBER

NUMBER

Multiplication

/

Left

NUMBER

NUMBER

Division

%

Left

NUMBER

NUMBER

Percentage

<

Left

NUMBER; TEXT

BOOL

Less than

>

Left

NUMBER; TEXT (*)

BOOL

Greater than

<=

Left

NUMBER; TEXT (*)

BOOL

Less than or equal

>=

Left

NUMBER; TEXT (*)

BOOL

Greater than or equal

=

Left

Left and right the same type; NUMBER or BOOL

BOOL

Equal to

<>

Left

Left and right the same type: NUMBER or BOOL

BOOL

Not equal to

AND

Left

BOOL

BOOL

Left AND right operand must be TRUE for the result to be TRUE.

OR

Left

BOOL

BOOL

Left OR right or both operands must be TRUE for the result to be TRUE

(*) Note

Comparing 2 text values with dyadic operators could fail if you try to compare 2 text values that use a different encoding system. It is better to use the function compare_characters in these cases to avoid problems.

Priorities

The operators have the following priorities ( where 1 is the highest priority and 7 the lowest):

  1. Monadic operators
  2. %, * and /
  3. + and -
  4. <=, <, >= and >
  5. = and <>
  6. AND
  7. OR

Note

Monadic operators have a higher priority than dyadic operators. So: -2+5 = 3.