English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang List nthtail Method

Erlang List

Return the Nth tail of the list, which is a sublist of the list, starting from N + 1Start and continue until the end of the list

Syntax

nthtail(N, List)

Parameter

  • N −The nth position from the end, which needs to return the element from.

  • Lst −Element list.

Return value

Return the Nth tail of the list, which is a sublist of the list, starting from N + 1Start, and continue until the end of the list.

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

When we run the above program, we will get the following results.

[3]

Erlang List