CopyTIA

From SCAR Divi Manual
Jump to: navigation, search

Definition

function CopyTIA(const TIA: TIntArray): TIntArray;

Availability

SCAR Divi 3.38 > Current

Description

Creates a new TIntArray with a copy of every element in the given array TIA. An extended function with additional functionality is available as CopyTIAEx.

Example

var
  TIA, TIA2: TIntArray;

begin
  TIA := [7, 6, 2, 0, 1];
  TIA2 := TIA;
  SortTIA(TIA2);
  WriteLn('TIA passed by reference to TIA2:');
  WriteLn('TIA: ' + TIAToStr(TIA));
  WriteLn('TIA2: ' + TIAToStr(TIA2));

  TIA := [7, 6, 2, 0, 1];
  TIA2 := CopyTIA(TIA);
  SortTIA(TIA2);
  WriteLn('TIA passed by value to TIA2:');
  WriteLn('TIA: ' + TIAToStr(TIA));
  WriteLn('TIA2: ' + TIAToStr(TIA2));
end.

Output:

TIA passed by reference to TIA2:
TIA: 0,1,2,6,7
TIA2: 0,1,2,6,7
TIA passed by value to TIA2:
TIA: 7,6,2,0,1
TIA2: 0,1,2,6,7

See Also