copy( dest, source )


Parameters

  Type Description
dest lvalue user variable
source expression value to copy 

_result

Not set.

Descriptions

Copies both the root value and all array and property elements from source to the user variable specified by dest. After the copy, the dest variable is an exact duplicate of source. Any property or array elements that existing on dest before the copy are removed during the copy. Copy performs a deep copy, meaning nested array and property elements are also copied.

In the example below, the user defined variable var is initialized with a value of 10 and a property named test with a value of 20. After the copy command, newvar will also have a root value of 10 and a property named test with a value of 20. After the copy command newvar[0] will no longer exist.

var = 10
var.text = 20
newvar = 30
newvar[0] = "hi"
copy( newvar, var )


If the dest user variable does not exist, it is automatically created by using it as the first parameter to the copy command. For more information see the user variables topic.

See Also

assignment (=), initialize, clear, isequal, cleararray, countarray, setarraycount, clearprops, hasprop, countprops, getpropname, user variables