此方法用于获取映射中特定键的值。
get(key,map)
key −这是需要为其返回值的密钥。
map −这是需要在其中搜索键的映射。
如果在映射上找到键,则返回值。
-module(helloworld).
-export([start/0]).
start() ->
Lst1 = [{"a",1},{"b",2},{"c",3}],
Map1 = maps:from_list(Lst1),
io:fwrite("~p~n",[maps:get("a",Map1)]).输出结果
上面程序的输出如下。
1