Erlang – member

Erlang member

In this guide, we will discuss Erlang member. Checks if an element is present in the list or not.

Syntax

member(element, lst1)

Parameters

  • Element − The element to search in the list.
  • Lst1 − The list of elements.

Return Value

Returns true if the element is present in the list , else returns false.

For example

-module(helloworld). 
-import(lists,[member/2]). 
-export([start/0]). 

start() -> 
   Lst1=[1,2,3,4], 
   io:fwrite("~w~n",[member(3,Lst1)]).

Output

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

true

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply