This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Programming / Assignments  /
PreIncrement

  • ++ x increases the value of x by 1, returning the new value of x.
  • PreIncrement has attribute HoldFirst.
  • ++ x is equivalent to x = x +1.
  • See the Mathematica book: Section 2.4.4.
  • See also: Increment, AddTo, Set.

    Further Examples

    This initializes the variable i to the value 7, increments it, checks its value, and clears it.

    In[1]:=

    Out[1]=

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]=

    In[4]:=