Skip to content

AddTo

AddTo[a, b] adds b to a and returns the new value.

Attributes[AddTo] := {HoldFirst, Protected}

Simple examples

In[1]:= toModify = 3
Out[1]= 3
In[2]:= AddTo[toModify, 2]
Out[2]= 5
In[3]:= toModify
Out[3]= 5