List.first
You're seeing just the function
first
, go back to List module for more information.
Specs
Returns the first element in list
or default
if list
is empty.
first/2
has been introduced in Elixir v1.12.0, while first/1
has been available since v1.0.0.
Examples
iex> List.first([])
nil
iex> List.first([], 1)
1
iex> List.first([1])
1
iex> List.first([1, 2, 3])
1