first

..  first(coll)

Get the first element of an iterable collection. Returns the start 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> first(foo)
1

julia> first([-1:-2:-10])
-1

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

See Also

countfrom, cycle, done, drop, eachindex, enumerate, first, repeated, rest, start, svds, take, vecdot, vecnorm, zip,

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: