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 / Scoping  /
Unique

  • Unique[ ] generates a new symbol, whose name is of the form $ nnn.
  • Unique[ x ] generates a new symbol, with a name of the form x $ nnn.
  • Unique[ x , y , ... ] generates a list of new symbols.
  • Unique[" xxx "] generates a new symbol, with a name of the form xxxnnn.
  • Unique[ x ] numbers the symbols it creates using $ModuleNumber, and increments $ModuleNumber every time it is called.
  • Unique[" xxx "] numbers the symbols it creates sequentially, starting at 1 for each string xxx.
  • Unique[ name , , , ... ] generates a symbol which has the attributes .
  • See the Mathematica book: Section 2.6.3.
  • See also: Symbol, ToExpression, Names, C, Module, CharacterRange.

    Further Examples

    Here are several examples of new symbols generated using Unique.

    In[1]:=

    Out[1]=

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]=