CopyArray()
Summary
Makes a copy of the array, including nested sub-arrays, to any depth.
Syntax
new_arr = CopyArray(array arr)
| Argument | Contents |
|---|---|
| arr | The array to be copied |
Returns
A new array with a copy of the original array.
Notes
-
Assigning or concatenating one array to another does not make a copy of the array, but instead points to the array. This function is the way to make a completely new copy of an array.
Example
a = {1,'ABC',3.14159}
b = a // b points to a
c = CopyArray(a) // c is a completely new array
a[1] = 23 // b[1] also changes to 23, but c[1] is unchanged
See Also
| Function | Summary |
|---|---|
| CompareArrays() | Compares two arrays, element by element |
| ReverseArray() | Returns a new array, with the same elements as the input array, but in the reverse order |
| Subarray() | Extracts a subset of an array |