Erlang – max

Erlang max

In this guide, we will discuss Erlang max. Returns the element of the list which has the maximum value.

Syntax

max(lst1)

Parameters

  • Lst1 − The list of elements.

Return Value

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

For example

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

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

Output

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

4

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply