TAL Programmer's Guide
Assignment Expression
Using Special Expressions
13–2 096254 Tandem Computers Incorporated
Assignment
Expression
The assignment expression assigns the value of an expression to a variable.
To use an assignment expression, specify:
The identifier of a variable
An assignment operator (:=)
An expression that represents a value of the same data type as the variable. The
result of the expression becomes the result of the assignment expression. The
expression can be either:
An arithmetic expression
A conditional expression (excluding a relational operator with no operands),
the result of which has data type INT.
For example, you can increment a variable by specifying an assignment expression in
an IF statement. As long as A + 1 is not 0 in the following example, the condition is
true and the THEN clause executes:
IF (a := a + 1) THEN ... ;
You can use an assignment expression as an index. In the following example, A is
incremented and accesses the next array element:
IF array[a := a + 1] <> 0 THEN ... ;
You can use an assignment expression in a relational form. The following example
assigns the value of B to A, then checks for equality with 0:
IF (a := b) = 0 THEN ... ;
You can use assignment expressions to assign a value to multiple variables:
a := b := c := d := 0;