represents the settable persistent value with which the symbol sym will be initialized.
represents the settable initialization value for the symbol with the specified complete name.
specifies the persistence locations to search for a possible initialization value.
Details and Options
- InitializationValue[sym] is equivalent to InitializationValue[sym,$PersistencePath].
- InitializationValue[sym]=value sets an initialization value for sym.
- InitializationValue[sym]=value is equivalent to InitializationValue[sym,$PersistenceBase]=value.
- The following options can be given:
EvaluationEnvironment $EvaluationEnvironment the environment in which the value should be used MergingFunction Automatic the function applied to the list of values found ValuePreprocessingFunction Identity the function applied to new values to be assigned ExpirationDate None when the value should expire PersistenceTime None how long the value should persist
- In InitializationValue[sym,loc], possible forms for the persistence location loc include:
PersistenceLocation["type"] "Local", "Cloud", "FrontEndSession", etc. locations "type" equivalent to PersistenceLocation["type"] PersistenceLocation["type","base"] location with a particular base (directory etc.) "type""base" equivalent to PersistenceLocation["type","base"]
- Supported location types include:
"KernelSession" current invocation of the Wolfram Language kernel "FrontEndSession" current invocation of the Wolfram Notebook front end "ServerSession" persistence for requests on a single web server "CookieManaged" persistence based on a Wolfram browser cookie "Local" local to a computer, based on user home directory "LocalShared" local to a computer, based on $BaseDirectory "Cloud" in the cloud defined by the current $CloudBase "Installation" installation defaults
- InitializationValue[sym]=$NoValue specifies that the symbol sym should be unset on initialization.
- Before a new value is assigned in InitializationValue[sym]=value, any specified value preprocessing function is applied to value before the value is assigned.
- If the preprocessing function returns $Failed, the assignment is not performed.
- If no explicit setting for ValuePreprocessingFunction is given, the setting to use is looked up on $PersistencePath.
- An expired initialization value is treated as nonexistent, and the underlying persistent object may be removed.
- Initialization values can be removed with Remove. Remove[InitializationValue[name]] is equivalent to Remove[InitializationValue[name,$PersistenceBase]].
Examplesopen allclose all
Basic Examples (2)
Generalizations & Extensions (1)
Set a value for $GeoLocation tied to your login account:
Properties & Relations (2)
Wolfram Research (2017), InitializationValue, Wolfram Language function, https://reference.wolfram.com/language/ref/InitializationValue.html (updated 2019).
Wolfram Language. 2017. "InitializationValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/InitializationValue.html.
Wolfram Language. (2017). InitializationValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InitializationValue.html