({{, (RefLink[$ModuleNumber, paclet:ref/$ModuleNumber])
gives the current serial number to be used for local variables that are created. }})

OpenersNotesSection(Spacer1)Details

(RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]) is incremented every time (RefLink[Module, paclet:ref/Module]) or (RefLink[Unique, paclet:ref/Unique]) is called.

Every Wolfram System session starts with (RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]) set to 1.

You can reset (RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]) to a positive machine integer, but if you do so, naming conflicts may lead to inefficiencies.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Each use of (RefLink[Module, paclet:ref/Module]) increments (RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]):

{$ModuleNumber,Module[{x},x],$ModuleNumber}

You can reset (RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]):

$ModuleNumber=17;{Module[{x},x],$ModuleNumber}

OpenersExampleSection1(Spacer1)Applications  (1)

Use a module number dependent on your Wolfram System session:

$ModuleNumber= $ProcessID*2^20

(RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]) will now increment starting from this number:

$ModuleNumber

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

(RefLink[$ModuleNumber, paclet:ref/$ModuleNumber]) is also used by (RefLink[Unique, paclet:ref/Unique]) to create new symbols from given ones:

{$ModuleNumber,Unique[x],$ModuleNumber}

If given a string, it creates the first available symbol of the form xnnn:

Unique["x"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[$ProcessID, paclet:ref/$ProcessID])  ▪  (RefLink[Temporary, paclet:ref/Temporary])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[How Modules Work, paclet:tutorial/HowModulesWork])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Global Computation Settings & Parameters, paclet:guide/GlobalComputationSettingsAndParameters])}, {▪(RefLinkPlain[Namespace Management, paclet:guide/NamespaceManagement])}})}})