Mathematica > Core Language > Package Development > Namespace Management > $ModuleNumber >

$ModuleNumber

$ModuleNumber
gives the current serial number to be used for local variables that are created.
  • You can reset $ModuleNumber to any positive integer, but if you do so, you run the risk of creating naming conflicts.
Each use of Module increments $ModuleNumber:
You can reset $ModuleNumber:
Each use of Module increments $ModuleNumber:
In[1]:=
Click for copyable input
Out[1]=
 
You can reset $ModuleNumber:
In[1]:=
Click for copyable input
Out[1]=
Use a unique module number in your Mathematica session:
$ModuleNumber will now increment starting from this number:
$ModuleNumber is also used by Unique to create new symbols from given ones:
If given a string, it creates the first available symbol of the form xnnn:
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF