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

Erlang List Sublist Method

Erlang List

Return the sublist of elements.

Syntax

sublist(lst,len)

Parameter

  • Lst −The element list.

  • Len −The number of elements to generate the sublist from.

Return Value

Return the sublist of elements.

-module(helloworld). 
-import(lists,[sublist/2]). 
-export([start/0]). 
start() -> 
   Lst1=[5,6,4], 
   io:fwrite("~p~n",[sublist(Lst1,2)]).

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

[5,6]

Erlang List