AssociateTo
Details

- AssociateTo has attribute HoldFirst.
- AssociateTo effectively modifies the value of a in place.
Examples
Basic Examples (3)Summary of the most common use cases
In[1]:=1

✖
https://wolfram.com/xid/09by79kp1-pv6nu8
Out[1]=1

Change the value associated with a:
In[2]:=2

✖
https://wolfram.com/xid/09by79kp1-gsjuix
Out[2]=2

If a key is not already in the association, it is added to it:
In[3]:=3

✖
https://wolfram.com/xid/09by79kp1-ue3pxc
Out[3]=3

Change several values in an association:
In[1]:=1

✖
https://wolfram.com/xid/09by79kp1-h7n2ah
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/09by79kp1-kyj0rs
Out[2]=2

Append one association to another:
In[1]:=1

✖
https://wolfram.com/xid/09by79kp1-8436m0
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/09by79kp1
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/09by79kp1-hbu7uu
Out[3]=3

Wolfram Research (2014), AssociateTo, Wolfram Language function, https://reference.wolfram.com/language/ref/AssociateTo.html.
✖
Wolfram Research (2014), AssociateTo, Wolfram Language function, https://reference.wolfram.com/language/ref/AssociateTo.html.
Text
Wolfram Research (2014), AssociateTo, Wolfram Language function, https://reference.wolfram.com/language/ref/AssociateTo.html.
✖
Wolfram Research (2014), AssociateTo, Wolfram Language function, https://reference.wolfram.com/language/ref/AssociateTo.html.
CMS
Wolfram Language. 2014. "AssociateTo." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AssociateTo.html.
✖
Wolfram Language. 2014. "AssociateTo." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AssociateTo.html.
APA
Wolfram Language. (2014). AssociateTo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AssociateTo.html
✖
Wolfram Language. (2014). AssociateTo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AssociateTo.html
BibTeX
✖
@misc{reference.wolfram_2025_associateto, author="Wolfram Research", title="{AssociateTo}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/AssociateTo.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_associateto, organization={Wolfram Research}, title={AssociateTo}, year={2014}, url={https://reference.wolfram.com/language/ref/AssociateTo.html}, note=[Accessed: 26-March-2025
]}