gives the current serial number to be used for local variables that are created.


  • $ModuleNumber is incremented every time Module or Unique is called.
  • Every Wolfram System session starts with $ModuleNumber set to 1.
  • You can reset $ModuleNumber to a positive machine integer, but if you do so, naming conflicts may lead to inefficiencies.


open allclose all

Basic Examples  (2)

Each use of Module increments $ModuleNumber:

You can reset $ModuleNumber:

Applications  (1)

Use a module number dependent on your Wolfram System session:

$ModuleNumber will now increment starting from this number:

Properties & Relations  (1)

$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:

Introduced in 1991