English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Returns the Nth element of the List
nth(N,List)
N −The nth value to be returned from the list
Lst −Element List
Returns the Nth element of the ListCountElement
-module(helloworld). -import(lists,[nth/2]). -export([start/0]). start() -> Lst1 = [1,2,3, io:fwrite("~p~n",[nth(2,Lst1)]).
When we run the above program, we will get the following results.
2