Erlang - min


Advertisements

Returns the element of the list which has the minimum value.

Syntax

min(lst1)

Parameters

  • Lst1 − The list of elements

Return Value

Returns the element of the list which has the minimum value.

For example

-module(helloworld). 
-import(lists,[min/1]). 
-export([start/0]). 

start() -> 
   Lst1 = [1,2,3,4], 
   io:fwrite("~w~n",[min(Lst1)]).

Output

When we run the above program, we will get the following result.

1
erlang_lists.htm
Advertisements