Erlang – keys

Erlang keys

In this guide, we will discuss Erlang keys. This method is used to return all the keys from a map.

Syntax

keys(map)

Parameters

  • map − This is the map for which all the keys need to be returned.

Return Value

Returns the list of keys from the map.

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:keys(Map1)]).

Output

The output of the above program is as follows.

["a","b","c"]

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply