Name | Required | Multiple Values | Description |
---|---|---|---|
VAR | yes | no | The name of the variable |
TO | no | no | The value to be set |
DEVICE | no | no | A label device to store the variables |
The set action is using one single generic_label device to store all variables. By default the set action will look for a generic_label device named “_VARSTORE_”. This default can be overridden by adding a DEVICE statement defining different generic_label device.
If a TO statement is given, the variable will be set to the given value. If the variable doesn't exist yet it will be created.
If the TO statement is omitted, the variable will be deleted.
Varables created by the set action can be retrieved using the GETVAR function.
IF 1 == 1 THEN set VAR testvar TO foobar => Creates variable "testvar" in "_VARSTORE_" unless it already exists and sets its value to "foobar" IF 1 == 1 THEN set VAR testvar => Deletes variable "testvar" from "_VARSTORE_"if it exists" Both examples above will be using the default "_VARSTORE_" device. In the example below the "mylabel device is used instead" IF 1 == 1 THEN set VAR testvar TO foobar DEVICE mylabel => Creates variable "testvar" in "mylabel "unless it already exists and sets its value to "foobar.
Note: variable names cannot contain &, =, space or any control character.