返回List的第N个元素。
nth(N,List)
N - 从列表中返回的第n个值。
Lst - 元素列表。
返回List的第N th 元素。
-module(helloLearnfk). -import(lists,[nth/2]). -export([start/0]). start() -> Lst1=[1,2,3], io:fwrite("~p~n",[nth(2,Lst1)]).
当我们运行上述程序时,我们将得到以下输出。
2
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)