![]() |
|
Navigation |
Synopsis Return the last element of a list, if any.
Function
&T last(list[&T] lst) throws EmptyList
Usage
import List;
Description Also see tail that returns a list of one or more of the last elements of a list.
Examples
rascal>import List; ok rascal>last([1]); int: 1 rascal>last([3, 1, 4, 5]); int: 5 rascal>last(["zebra", "elephant", "snake", "owl"]); str: "owl" rascal>tail([3, 1, 4, 5]); list[int]: [1,4,5] Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]() ![]() |