Function type:
ELEMENT
Returns the last item in the specified list. This function can be applied to a list of any DGL data type.
Input/Output Items in the input list can be of any element type except string. For strings, see the functionstm_str_list_first_element
. Assume you have a list of states in the orderS1
,S2
,S3
andS4
. The list is assigned to the variablestate_list
. To find the last item in this list (S4
), use the following statements:VARIABLE
STATE state_id;
LIST OF STATE state_list;
INTEGER status;
.
.
.
state_id := stm_list_last_element (state_list, status);
WRITE (’\n The last state in the list is: ’,
stm_r_st_name (state_id, status));