This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

AddTo


adds dx to x and returns the new value of x.
  • is equivalent to .
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Add to a numerical value:
Add to a symbolic value:
Add to all values in a list:
Find the first prime above one million:
AddTo is a short form of this assignment:
PreIncrement is a special case of AddTo:
SubtractFrom is closely related:
A related operation for lists is AppendTo:
A variable to be incremented must have an initial value:
New in 1