Retained variables enable you to specify a default value for a statically declared array. If specified, all the elements of the array will be set to this value when the array is instantiated. For example, an array declaration such as:
[
Data[10] = 0;
]
will result in all 10 elements of the data array to have the initial value of "0".
If the array with the initial value specified has a default value, the default value will only be used if there is no suitable retained value .VAL file.
Recompiling to change the number or size of dimensions of a retained variable will cause any retained .VAL files previously saved with the old variable format to be ignored.
Note: Retained variables are similar in behavior to persistent variables (see Persistent Variables); in fact, persistent variables are equivalent to "Shared Retained".