Erlang – remove

Erlang remove

In this guide, we will discuss Erlang remove. This method is used to remove a key value from the map.

Syntax

remove(key,map)

Parameters

  • key − This is the key which needs to be removed from the map.
  • map − This is the map for which the key needs to be removed.

Return Value

Returns the map with the removed key.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   Lst1 = [{"a",1},{"b",2},{"c",3}], 
   Map1 = maps:from_list(Lst1), 
   io:fwrite("~p~n",[maps:remove("a",Map1)]).

Output

The output of the above program is as follows −

#{"b" => 2,"c" => 3}

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply