Utility Functions : List of Utility Functions : stm_list_last_element

stm_list_last_element

Function type: ELEMENT

Description
Returns the last item in the specified list. This function can be applied to a list of any DGL data type.
Syntax
stm_list_last_element (list, status)
Arguments
 
Input/Output
Items in the input list can be of any element type except string. For strings, see the function stm_str_list_first_element.

 

Status Codes
Example
Assume you have a list of states in the order S1, S2, S3 and S4. The list is assigned to the variable state_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));