English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang List max Method

Erlang List

Return the element with the maximum value in the list.

Syntax

max(lst1)

Parameters

  • Lst1 −Element List.

Return Value

Return the element with the maximum value in the list.

-module(helloworld). 
-import(lists,[max/1]). 
-export([start/0]). 
start() -> 
   Lst1 = [1,2,3,4], 
   io:fwrite("~w~n",[max(Lst1)]).

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

4

Erlang List