ListClone Function

Action

Makes a copy of a list. The origin and the target list parameters have to be of the same type. The elements of the target list are removed before the elements of the origin list are copied.

Include file

List.bdh

Syntax

ListClone(
   in theList: list,
   inout resultList: list) : boolean;
Parameter Description
theList List of number, boolean, float or string.
resultList List of number, boolean, float or string. The type of this list must be the same as the type of theList. resultList contains a copy of all elements of theList as an out parameter.

Return value

  • true if successful
  • false otherwise

Example

transaction TAListClone
var
  lstNumber: list of number init 1, 2, 3, 4, 5, 6;
  lstCopy: list of number init 33, 44, 55;
  retVal1: boolean;
begin
  retVal1 := ListClone(lstNumber, lstCopy);
  if(retVal1 = true) then
    ListPrint(lstCopy);
  else
    writeln("ListClone did not work!");
  end;
end TAListClone;

Output

element 1: 1
element 2: 2
element 3: 3
element 4: 4
element 5: 5
element 6: 6