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:

In[1]:=
Click for copyable input
Out[1]=

Set an initialization value for a variable:

In[1]:=
Click for copyable input
Out[1]=

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

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Generalizations & Extensions  (1)

Options  (5)

Applications  (2)

Properties & Relations  (2)

Possible Issues  (1)

See Also

Initialize  InitializationObjects  $Initialization  PersistentValue

Introduced in 2017
(11.2)