AssociateTo

AssociateTo[a,keyval]
changes the association a by adding the key-value pair .

AssociateTo[a,{key1val1,key2val2,}]
adds all key-value pairs .

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Create an association:

In[1]:=
Click for copyable input
Out[1]=

Change the value associated with :

In[2]:=
Click for copyable input
Out[2]=

If a key is not already in the association, it is added to it:

In[3]:=
Click for copyable input
Out[3]=

Change several values in an association:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2014
(10.0)