Get the last item in a list Using Elixir Program - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, September 28, 2017

Get the last item in a list Using Elixir Program

 This shows how to get the last item in a list. Keep in mind that it is more effecient to get the head of a list than the last item when processing lists.

Program:

:c = List.last([:a, :b, :c])

# nil is returned for an empty list
nil = List.last([])

No comments:

Post a Comment