assignment

assignment


ASSIGNED Index Level AUX
Syntax variable = expression  
Category BASIC
Type Definition
Description value of an expression to a variable.

The variable can be a simple variable, an array element, a dynamic array element, a substring, or all of the above.
Options
See Also LET substring expressions dynamic array dimensioned array array references arrays, relational expressions CLEAR DIM EQUATE > ASSIGNED nuclear tokens data representation array substring assignment substring field store \= substring extraction MAT : = *= += -= /= := INSERT EXTRACT CAT +
Example name = "george"

The variable "name" is assigned the string "george".

result = (unit.price * qty)

The variable "result" is assigned to the result of the arithmetic expression.

line = result: " is the answer"

The variable "line" is assigned the result of the string expression.

item<-1> = code

Adds the value of "code" as the last attribute of the dynamic array "item".

item<codes,-1> = code

Adds the value of "code" as the last value in an attribute of codes.

customer.array(5) = "fred"

The value, "fred", is assigned to the fifth element of the dimensioned array, "customer.array".

item<1,2,2> = "100"

The second subvalue in the second value in the first attribute of the string in "item" is replaces with the string "100".

string[3,2] = "ca"

Character positions 3 and 4 of "string" are replaced with the string "ca".

item<1,2,1>[3,2] = "ca"

The 3rd and 4th character positions of the string found in the first subvalue in the second value in the first attribute of "item" is replaced with the string "ca".
Warnings Variables must be assigned a value prior to use in any expression.

When a variable is used in an expression on the right-hand side of an assignment equal sign (=) before it is used on the left-hand side, the following runtime warning message is displayed:

[b10] in program "pgm", line n: Variable has not been assigned a value; zero used.

This also occurs if the variable is used in a substring replace or dynamic array reference before it is assigned an initial value.
Compatibility D3 7.0 AP R83
ASSIGNED Index Level AUX