ListRemoveFirst Function

Action

Removes the first element of a list.

Include file

List.bdh

Syntax

ListRemoveFirst(
   inout theList: list) : boolean;
Parameter Description
theList List of number, boolean, float or string, which contains one element less as an out parameter.

Return value

  • true if successful
  • false otherwise

Example

transaction TAListRemoveFirst
var
  lstNumber: list of number init 111, 1, 2, 3, 4, 5;
  retVal1: boolean;
  nr: number;
begin
  retVal1 := ListRemoveFirst(lstNumber);
  if(retVal1 = true) then
    nr := -1;
    ListGetFirst(lstNumber, nr);
    writeln("element at position 1: " + string(nr));
    writeln("length of list: " + string(ListGetLength(lstNumber)));
  else
    writeln("ListRemoveFirst did not work!");
  end;
end TAListRemoveFirst;   

Output

element at position 1: 1
length of list: 5