$ModuleNumber

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

Wolfram Research (1991), $ModuleNumber, Wolfram Language function, https://reference.wolfram.com/language/ref/$ModuleNumber.html.

Text

Wolfram Research (1991), $ModuleNumber, Wolfram Language function, https://reference.wolfram.com/language/ref/$ModuleNumber.html.

BibTeX

@misc{reference.wolfram_2021_$modulenumber, author="Wolfram Research", title="{$ModuleNumber}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/$ModuleNumber.html}", note=[Accessed: 21-June-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_$modulenumber, organization={Wolfram Research}, title={$ModuleNumber}, year={1991}, url={https://reference.wolfram.com/language/ref/$ModuleNumber.html}, note=[Accessed: 21-June-2021 ]}

CMS

Wolfram Language. 1991. "$ModuleNumber." Wolfram Language & System Documentation Center. Wolfram Research. 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