目录

droplast

删除List的最后一个元素。 该列表应该是非空的,否则该函数将与function_clause崩溃。

语法 (Syntax)

droplast(List1)

参数 (Parameters)

  • List1 - 值列表。

返回值 (Return Value)

返回删除了最后一个元素的新列表。

例如 (For example)

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

输出 (Output)

当我们运行上述程序时,我们将得到以下结果。

[1,2]
↑回到顶部↑
WIKI教程 @2018