Erlang - last 方法
返回列表的最后一个元素。
语法
last(lst1)
参数
Lst1 − 元素列表。
返回值
返回列表的最后一个元素。
例如
-module(helloworld). -import(lists,[last/1]). -export([start/0]). start() -> Lst1=[1,2,3,4], io:fwrite("~w~n",[last(Lst1)]).
输出
当我们运行上面的程序时,我们将得到以下结果。
4
返回列表的最后一个元素。
last(lst1)
Lst1 − 元素列表。
返回列表的最后一个元素。
-module(helloworld). -import(lists,[last/1]). -export([start/0]). start() -> Lst1=[1,2,3,4], io:fwrite("~w~n",[last(Lst1)]).
当我们运行上面的程序时,我们将得到以下结果。
4
如果您发现内容有误或提出修改建议,请随时向我们发送 E-mail 邮件:
421660149@qq.com
您的建议已发送到 W3schools。