Returns a copy of the last element of a list.
List.bdh
ListGetLast( in theList: list, inout retElement: union) : boolean;
Parameter | Description |
---|---|
theList | List of number, boolean, float or string. |
retElement | Number, boolean, float or string, which contains a copy of the last element of theList as an out parameter. Has to conform with the type of theList. |
transaction TAListGetLast var lstNumber: list of number init 10, 20, 30; numberElem: number; stringElem: string; retVal: boolean; begin retVal := ListGetLast(lstNumber, numberElem); if((retVal = true) and (numberElem = 30)) then writeln("ListGetLast worked! Value of numberElem: " + string(numberElem)); end; retVal := ListGetLast(lstNumber, stringElem); if(retVal = false) then writeln("ListGetLast did not work, the types do not match!"); end; end TAListGetLast;
ListGetLast worked! Value of numberElem: 30 ListGetLast did not work, the types do not match!