Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Expressions

&pagelevel(4)&pagelevel

As an alternative to constants of one of the types STRING, INTEGER or BOOLEAN as representations of values, assignments can make use of already existing variable values and results from function calls; these can be linked to each other or to constants by means of various operations. Such complex representations are referred to as expressions; they resemble the corresponding constructs of higher-level programming languages in function as well as notation.
Each expression supplies a result of one of the three basic types. The simplest case is an expression consisting of a single constant, the name of a variable (which must have a simple value) or a function call. These so-called base terms can be linked via operators; for each operator, the permissible type(s) of operands and results supplied by it are defined.

Expressions can contain the following operators:

Arithmetic operators:+, -, *, /, MOD

Relational operators:

<, >,  <=, >=, ==, <>

or (equivalent operators):

LT, GT, LE, GE, EQ, NE

Logical operators:

NOT, OR, AND, XOR

String operator (concatenation)://

A more detailed description of these operators is given as of "Operators ".

Where relational operators are used, both operands must have the same type (STRING, INTEGER or BOOLEAN; in the latter case, they can only be compared to see whether they are equal or not equal.) The comparison is performed depending on the operand type: the expression 12 > 9 will supply the value TRUE, while the result of the string comparison
’12’ > ’9’ will be FALSE, since strings are compared character-by-character from left to right.

Since the hyphen can occur both in variable names and as an arithmetic operator (minus sign) in expressions, it must be preceded and followed by a blank when used as an operator in cases where it may be interpreted as a name part. For instance, the following command

/ I = I - 1

subtracts the constant 1 from the variable I and assigns the result to the same variable as its new value. The following command, however,

/ I = I-1

assigns the value of a variable I-1 to variable I.

The operators consisting of a string of letters such as MOD, EQ or AND must, of course, also be separated from any names or numbers preceding or following them. To enhance readability, it is generally advisable to write a blank before and after all operators, even in cases where syntactical analysis does not require it.

In addition to assignments by means of SET-VARIABLE, expressions may be used as operands in a few other commands (in particular those described in this manual).