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

Erlang List member Method

Erlang List

Check if the element exists in the list.

Syntax

member(element, lst1)

Parameter

  • Element −Element to Search in the List.

  • Lst1 −Element List.

Return Value

If the element exists in the list, it returns true; otherwise, it returns false.

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

Output Result

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

true

Erlang List