Returns a copy of the first element of a list.
List.bdh
ListGetFirst( 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 first element of theList as an out parameter. Has to conform with the type of theList. |
transaction TAListGetFirst var lstNumber: list of number init 10, 20, 30; numberElem: number; stringElem: string; retVal: boolean; begin retVal := ListGetFirst(lstNumber, numberElem); if((retVal = true) and (numberElem = 10)) then writeln("ListGetFirst worked! Value of numberElem: " + string(numberElem)); end; retVal := ListGetFirst(lstNumber, stringElem); if(retVal = false) then writeln("ListGetFirst did not work, the types do not match!"); end; end TAListGetFirst;
ListGetFirst worked! Value of numberElem: 10 ListGetFirst did not work, the types do not match!