getfirst


Purpose
Get the first element of a range set or a list.
Synopsis
function getfirst(r:range):integer
function getfirst(l:list):type_of_l
Arguments
A range set
A list
Return value
The first 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
getlast.


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