Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Defining Variables and Functions > Assignments > AddTo (+=) >

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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF