Mathematica 9 is now available
 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]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.