({{, (RefLink[Initialize, paclet:ref/Initialize])[sym] 
initializes the symbol sym from persistent values on the default persistence path.}, {, (RefLink[Initialize, paclet:ref/Initialize])[sym,{(Subscript[loc, 1]),…}]
initializes the symbol sym from persistent values on the persistence path {(Subscript[loc, 1]),…}.}, {, (RefLink[Initialize, paclet:ref/Initialize])["patt"]
initializes all variables matching the string pattern "patt".}})

OpenersNotesSection(Spacer1)Details and Options

The following option can be given:

(RefLink[Initialize, paclet:ref/Initialize])[(RefLink[All, paclet:ref/All])] is equivalent to (RefLink[Initialize, paclet:ref/Initialize])["*"].

(RefLink[Initialize, paclet:ref/Initialize])[spec] is equivalent to (RefLink[Initialize, paclet:ref/Initialize])[spec,(RefLink[$PersistencePath, paclet:ref/$PersistencePath])].

A persistence location is given as (RefLink[PersistenceLocation, paclet:ref/PersistenceLocation])["type"] or "type".

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Set an initialization value for a variable:

InitializationValue[myvar,"KernelSession"]=42

Initialize the variable from the persistent value:

Initialize[myvar];

myvar

OpenersExampleSection1(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)MergingFunction  (1)

Establish a default value and merging function for an initialization value:

InitializationValue[ivar,"Local",MergingFunction->Flatten]={};

Add an initialization value at the front end persistence location:

InitializationValue[ivar,"FrontEndSession"]=ival1;

The resulting initialization value now uses the default merging function:

InitializationValue[ivar]

You can override the default merging function to use for an initialization:

Initialize[ivar,MergingFunction->First];
ivar

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

Set an initialization value for a variable persisting for the current front end session:

InitializationValue[Global`myvar,"FrontEndSession"]=43

Quit and restart the kernel:

Quit[];

Each newly started kernel will automatically invoke (RefLink[Initialize, paclet:ref/Initialize]) for all variables:

Global`myvar

After quitting and restarting the front end, the initialization value is gone:

Global`myvar

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[InitializationObjects, paclet:ref/InitializationObjects])  ▪  (RefLink[InitializationValue, paclet:ref/InitializationValue])  ▪  (RefLink[PersistenceLocation, paclet:ref/PersistenceLocation])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Initialization & Provisioning, paclet:guide/InitializationAndProvisioning])}, {▪(RefLinkPlain[Setting Persistent Values, paclet:guide/SettingPersistentValues])}})}})