Removes the last element of a list.
List.bdh
ListRemoveLast( inout theList: list) : boolean;
Parameter | Description |
---|---|
theList | List of number, boolean, float or string, which contains one element less as an out parameter. |
transaction TAListRemoveLast var lstNumber: list of number init 1, 2, 3, 4, 5, 555; retVal1: boolean; nr: number; begin retVal1 := ListRemoveLast(lstNumber); if(retVal1 = true) then nr := -1; ListGetLast(lstNumber, nr); writeln("element at last position: " + string(nr)); writeln("length of list: " + string(ListGetLength(lstNumber))); else writeln("ListRemoveLast did not work!"); end; end TAListRemoveLast;
element at last position: 5 length of list: 5