last
返回列表的最后一个元素。
语法 (Syntax)
last(lst1)
参数 (Parameters)
Lst1 - 元素列表。
返回值 (Return Value)
返回列表的最后一个元素。
例如 (For example)
-module(helloworld).
-import(lists,[last/1]).
-export([start/0]).
start() ->
Lst1=[1,2,3,4],
io:fwrite("~w~n",[last(Lst1)]).
输出 (Output)
当我们运行上述程序时,我们将得到以下结果。
4