Array Variable Assignments

A variable of a particular array type can be copied to another variable of the same array type. For example…

Integer[] iValues iMoreValues

Move iValues to iMoreValues

The above copies the variable iValues to the variable iMoreValues using a deep memberwise copy operation. Each element in turn is copied from the iValues variable to the iMoreValues. The following code would be functionally equivalent to the first example…

Integer[] iValues iMoreValues

Integer iCount iSize

 

Move (SizeOfArray(iValues)) to iSize

For iCount From 0 to (iSize-1)

    Move iValues[iCount] to iMoreValues[iCount]

Loop

Array variable assignments of incompatible types, as well as array variable assignment to/from a non-array type, are illegal, and will result in a run-time error.

Array variables are assignment compatible only if they are of the same type and number of dimensions, and:

  Dynamic arrays adopt the size of the source array in the assignment. And jagged arrays adopt the size of each dimension of the source array in the assignment.

See Also

Array Types