last

..  last(coll)

Get the last element of an ordered collection, if it can be computed in O(1) time.
This is accomplished by calling :func:`endof` to get the last index.
Returns the end point of a :obj:`Range` even if it is empty.

Examples

julia> foo = [1 2 3; 4 5 6]
2x3 Array{Int64,2}:
 1  2  3
 4  5  6

julia> last(foo)
6

julia> last([-1:-2:-10])
-9

julia> last(1:2:0)  # empty range
0

See Also

Array, broadcast, cat, combinations, conj!, digits!, fieldnames, fill, fill!, last, length, maximum, minimum, ones, parent, parentindexes, partitions, permutations, pointer, pointer_to_array, promote_shape, rand!, reshape, scale, similar, sum, sum_kbn, takebuf_array, transpose!, vec, zeros,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: