%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 2021-2025. All Rights Reserved.
%%
%% %CopyrightEnd%

[;1m  put(Key, Val)[0m

  Adds a new [;;4mKey[0m to the process dictionary, associated with the
  value [;;4mVal[0m, and returns [;;4mundefined[0m. If [;;4mKey[0m exists, the old
  value is deleted and replaced by [;;4mVal[0m, and the function returns
  the old value.

  The average time complexity for the current implementation of this
  function is O([;;4m1[0m) and the worst case time complexity is O([;;4mN[0m),
  where [;;4mN[0m is the number of items in the process dictionary.

  For example:

    > X = put(name, walrus), Y = put(name, carpenter),
    Z = get(name),
    {X, Y, Z}.
    {undefined,walrus,carpenter}

  [;;4mNote[0m

    The values stored when [;;4mput[0m is evaluated within the scope of
    a [;;4mcatch[0m are not retracted if a [;;4mthrow[0m is evaluated, or if
    an error occurs.
