InitializationValue

InitializationValue[sym]

represents the settable persistent value with which the symbol sym will be initialized.

InitializationValue["context`name"]

represents the settable initialization value for the symbol with the specified complete name.

InitializationValue[sym,{loc1,}]

specifies the persistence locations to search for a possible initialization value.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Set a value to be evaluated every time the kernel starts:

Set an initialization value for a variable:

Initialize the variable from the persistent value in the current kernel session:

Generalizations & Extensions  (1)

Set an initialization value for parallel subkernels:

All newly launched parallel subkernels use the given value:

Remove the initialization value:

Options  (5)

EvaluationEnvironment  (1)

Set an initialization value for parallel subkernels:

MergingFunction  (1)

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

Add an initialization value at the front end persistence location:

The resulting initialization value now uses the default merging function:

When the variable is initialized, the default merging function is used:

ValuePreprocessingFunction  (1)

Define a value preprocessing function for a particular initialization value that accepts only integers:

Assign an integer at any persistence location:

Assigning anything else generates an error, and the assignment is not performed:

PersistenceTime  (1)

Define an initialization that will expire in 5 seconds:

ExpirationDate  (1)

Define an initialization value that expires at the beginning of next year:

Applications  (2)

Override the default persistence base in all kernels started under the current front end session:

Quit and restart the kernel:

Set a value for $GeoLocation tied to your login account:

Properties & Relations  (2)

Initialization values are stored in persistent objects:

List the existing initialization values in all editable persistence locations:

Remove them:

Possible Issues  (1)

Create two initialization values for a symbol in different locations:

Remove by default removes only the value in the location given by $PersistenceBase:

Remove all values that might exist anywhere in the locations given by $PersistencePath:

Wolfram Research (2017), InitializationValue, Wolfram Language function, https://reference.wolfram.com/language/ref/InitializationValue.html (updated 2019).

Text

Wolfram Research (2017), InitializationValue, Wolfram Language function, https://reference.wolfram.com/language/ref/InitializationValue.html (updated 2019).

BibTeX

@misc{reference.wolfram_2020_initializationvalue, author="Wolfram Research", title="{InitializationValue}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/InitializationValue.html}", note=[Accessed: 15-January-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_initializationvalue, organization={Wolfram Research}, title={InitializationValue}, year={2019}, url={https://reference.wolfram.com/language/ref/InitializationValue.html}, note=[Accessed: 15-January-2021 ]}

CMS

Wolfram Language. 2017. "InitializationValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/InitializationValue.html.

APA

Wolfram Language. (2017). InitializationValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InitializationValue.html