$ModuleNumber
gives the current serial number to be used for local variables that are created.
Details
- $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. »
Examples
open allclose allBasic Examples (1)
Each use of Module increments $ModuleNumber:
Applications (1)
Use a module number dependent on your Wolfram System session:
$ModuleNumber will now increment starting from this number:
Properties & Relations (2)
$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:
You can reset $ModuleNumber:
However, its next use may cause $ModuleNumber to be incremented more than once due to conflicts:
Text
Wolfram Research (1991), $ModuleNumber, Wolfram Language function, https://reference.wolfram.com/language/ref/$ModuleNumber.html (updated 2012).
CMS
Wolfram Language. 1991. "$ModuleNumber." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/$ModuleNumber.html.
APA
Wolfram Language. (1991). $ModuleNumber. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$ModuleNumber.html