Prism 6.0 Reference Manual

assign

Assigns the value of an expression to a variable or array.

SYNTAX

assign lval = expression [pset set_name | set_definition]

DESCRIPTION

Use the assign command to assign the value of expression to lval. lval can be any value that can go on the left-hand side of a statement in the language you are using, such as a variable or a Fortran array section. Prism performs the proper type coercions if the right-hand side does not have the same type as the left-hand side.

When issued in MP Prism, this command can take a pset qualifier. If used with a qualifier, it applies to the pset you specify. If used without a qualifier, it applies to the current pset. See " Using Pset Qualifiers" for more information on pset qualifiers.

EXAMPLES

This example assigns the value 1 to x:

assign x = 1

If x is an array, 1 is assigned to each element.

This example adds 2 to each element of array2 and assigns these values to array1:

assign array1 = array2 + 2

Note that array2 and array1 must be conformable.