$ModuleNumber

$ModuleNumber

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

Details

Examples

open allclose all

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

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

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

BibTeX

@misc{reference.wolfram_2024_$modulenumber, author="Wolfram Research", title="{$ModuleNumber}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/$ModuleNumber.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_$modulenumber, organization={Wolfram Research}, title={$ModuleNumber}, year={2012}, url={https://reference.wolfram.com/language/ref/$ModuleNumber.html}, note=[Accessed: 18-November-2024 ]}