AddTo
✖
AddTo
✖
x+=dx
adds dx to x and returns the new value of x.
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-ikq58e
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0e7pmhwp-d3oyff
Out[2]=2

Scope (4)Survey of the scope of standard use cases
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-3mn70w
Out[1]=1

In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-2dqqdg
Out[1]=1

In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-boaay
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0e7pmhwp-2v76mu
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/0e7pmhwp-koraoz
Out[3]=3

The first argument to AddTo need not be a symbol:
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-5axyxt
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0e7pmhwp-s6reew
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/0e7pmhwp-tck70d
Out[3]=3

Applications (1)Sample problems that can be solved with this function
Properties & Relations (4)Properties of the function, and connections to other functions
AddTo is a short form of this assignment:
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-5h1xz5
Out[1]=1

PreIncrement is a special case of AddTo:
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-lk1x9y
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0e7pmhwp-fbnbxw
Out[2]=2

SubtractFrom is closely related:
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-c27up6
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0e7pmhwp-hrn14p
Out[2]=2

A related operation for lists is AppendTo:
In[1]:=1

✖
https://wolfram.com/xid/0e7pmhwp-uwb0lf
In[2]:=2

✖
https://wolfram.com/xid/0e7pmhwp-5o39k8
Out[2]=2

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