Erlang - max



返回具有最大值元素的列表。

語法

max(lst1)

引數

  • Lst1 − 元素的列表。

返回值

返回具有最大值元素的列表。

例如

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

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

輸出

執行以上程式時,我們將獲得以下結果。

4
erlang_lists.htm
廣告