TAL Reference Manual

Expressions
TAL Reference Manual526371-001
4-6
Examples of Arithmetic Expressions
Examples of Arithmetic Expressions
Following are examples of arithmetic expressions:
var1 !operand
-var1 !- operand
+var1 * 2 !+ operand arithmetic-operator operand
var1 / var2 !operand arithmetic-operator operand
var1 * (–var2) !operand arithmetic-operator operand
2 * 3 + var / 2
2 * var * 4
Operands in Arithmetic Expressions
An operand consists of one or more elements that evaluate to a single value. Table 4-2
describes the operands that can make up an arithmetic expression.
Signed Arithmetic Operators
Signed arithmetic operators and the operand types on which they can operate are
shown in Table 4-3
on page 4-7
Table 4-2. Operands in Arithmetic Expressions
Element Description Example
Variable The identifier of a simple variable, array
element, pointer, structure data item, or
equivalenced variable, with or without @ or
an index
var[10]
Constant A character string or numeric constant 103375
LITERAL The identifier of a named constant file_size
Function
invocation
The invocation of a procedure that returns a
value
$LEN (x)
(expression) Any expression, enclosed in parentheses (x := y)
Code space item The identifier of a procedure, subprocedure,
or label prefixed with @ or a read-only array
optionally prefixed with @, with or without an
index
@label_a