# VAR CLEAR

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
VAR CLEAR
VAR SAVE
VAR RESTORE

Description:

VAR SAVE will save one or more variables to non volatile memory where they can be restored later (normally after a power interruption).
'var' can be any number of numeric or string variables and/or arrays. Arrays are specified by using empty brackets. For example: var()
The VAR SAVE command can be used repeatedly.
Variables that had been previously saved will be updated with their new value and any new variables (not previously saved) will be added to the saved list for later restoration.

VAR RESTORE will retrieve the previously saved variables and insert them (and their values) into the variable table.

VAR CLEAR will erase all saved variables.
Also, the saved variables will be automatically cleared by the NEW command or when a new program is loaded via AUTOSAVE, XMODEM, etc.
This command is normally used to save calibration data, options, and other data which needs to be retained across a power interruption.
Normally the VAR RESTORE command is placed at the start of the program so that previously saved variables are restored and immediately available to the program when it starts.

Notes:
The storage space available to this command is 4KB.
The memory used is battery backed RAM which operates at high speed and can be written to an unlimited number of times without restriction (unlike the Micromite).

Using VAR RESTORE without a previous save will have no effect and will not generate an error.

If, when using RESTORE, a variable with the same name already exists its value will be overwritten.

Saved arrays must be declared (using DIM) before they can be restored.

Be aware that string arrays can rapidly use up all the memory allocated to this command.
The LENGTH qualifier can be used when a string array is declared to reduce the size of the array (see the DIM command).
This is not needed for ordinary string variables.

The Micromites use flash memory for VAR SAVE so it should be used sparingly.
The CMM2 used battery backed RAM that uses the RTC battery.

Last edited: 29 September, 2020