up previous next
last

the last N elements of a list

Syntax
last(L: LIST): OBJECT
last(L: LIST, N: INT): OBJECT

Description
In the first form, the function returns the last element of L. In the second form, it returns the list of the last N elements of L.

The CoCoA equivalent to GAP last is the variable It .

Example
/**/  L := [1,2,3,4,5];
/**/  last(L);
5

/**/  last(L,3);
[3, 4, 5]

See Also