请参阅文档以 H
iex(1)> h List.last
def last(list)
Returns the last element in list or nil if list is empty.
Examples
┃ iex> List.last([])
┃ nil
┃
┃ iex> List.last([1])
┃ 1
┃
┃ iex> List.last([1, 2, 3])
┃ 3
iex(1)> h List.last
def last(list)
Returns the last element in list or nil if list is empty.
Examples
┃ iex> List.last([])
┃ nil
┃
┃ iex> List.last([1])
┃ 1
┃
┃ iex> List.last([1, 2, 3])
┃ 3