Erlang - put



此方法用于将键值对放入进程字典中。

语法

put(key,value)

参数

  • - 需要添加到进程字典的键。

  • - 需要添加到进程字典的值。

返回值

例如

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

start() -> 
   put(1,"One"), 
   put(2,"Two"), 
   io:fwrite("~p~n",[get()]).

输出

运行以上程序后,将得到以下结果。

[{2,"Two"},{1,"One"}]
erlang_bifs.htm
广告

© . All rights reserved.