Erlang - put


Advertisements

This method is used to put a key, value pair in the process dictionary.

Syntax

put(key,value)

Parameters

  • key − The key which needs to be added to the process dictionary.

  • value − The value which needs to be added to the process dictionary.

Return Value

None

For example

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

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

Output

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

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