CopyArray()

Syntax

Result = CopyArray(SourceArray(), DestinationArray())
Description
Copy every elements of 'SourceArray()' into 'DestinationArray()'. After a successful copy, the two arrays are identical. The arrays must have the same number of dimensions.

Parameters

SourceArray() The array to copy from.
DestinationArray() The array to copy to. Every element previously found in this array will be deleted. This array must be of the same type (native or structured) and the same number of dimensions of the source array.

Return value

Returns nonzero if the copy succeeded or zero if it failed.

Example

  Dim Numbers(5)
  Dim NumbersCopy(10)
  
  Numbers(0) = 128
  Numbers(5) = 256
  
  Debug "Array size before copy: "+Str(ArraySize(NumbersCopy())) ; will print 10
  
  CopyArray(Numbers(), NumbersCopy())
  
  Debug "Array size after copy: "+Str(ArraySize(NumbersCopy())) ; will print 5
  Debug NumbersCopy(0)
  Debug NumbersCopy(5)

See Also

CopyList(), CopyMap()

Supported OS

All

<- ArraySize() - Array Index - FreeArray() ->