getlast


Purpose
Get the last element of a range set or a list.
Synopsis
function getlast(r:range):integer
function getlast(l:list):type_of_l
Arguments
A range set
A list
Return value
The last element of the set or list.
Example
In this example the range set r is defined before its first and last elements are retrieved and displayed:
declarations
 r=2..8
end-declarations
  ...
writeln("First element of r: ", getfirst(r), 
        "\nLast element of r: ", getlast(r))
Further information
When applied to a list, the type of the function is the type of the list. An error is generated if the argument of the function is empty.
Related topics
getfirst.


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.