Increment
Increment[a]
adds 1 to a
and returns the original value.
Attributes[Increment] := {HoldFirst, Protected, ReadProtected}
Simple examples
In[1]:= toModify = 3 Out[1]= 3
In[2]:= Increment[toModify] Out[2]= 3
In[3]:= toModify Out[3]= 4
Increment[a]
adds 1 to a
and returns the original value.
Attributes[Increment] := {HoldFirst, Protected, ReadProtected}
In[1]:= toModify = 3 Out[1]= 3
In[2]:= Increment[toModify] Out[2]= 3
In[3]:= toModify Out[3]= 4