English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
返回List的第N个元素。
nth(N,List)
N −要从列表中返回的第n个值。
Lst −元素列表。
返回List的第N个元素。
-module(helloworld). -import(lists,[nth/2]). -export([start/0]). start() -> Lst1 = [1,2,3], io:fwrite("~p~n",[nth(2,Lst1)]).
当我们运行上面的程序时,我们将得到以下结果。
2