Set

Syntax

Command Description Return Value
Set <variable> <value> Sets the value of the variable The value the variable was set to
  • <variable>
    • A user variable or system variable name.
  • <value>
    • A string (a combination of characters enclosed in quotes, such as “Hello World”).
    • A number (a whole number, or a decimal number, such as 123 or 12.7).

Alternate Syntax

See: Assign command.

Description

Setting Values

The Set command sets the value of a variable. The variable can be user defined (such as xyz, LoopCount, or IsMyShowEnabled), or it may be a system variable (such as button.onColor or lcd.backlight. System variables always contain a “dot” character ( . ). User variables must not contain a “dot” character, otherwise, they will be interpreted as a system variable, and they will not be stored properly.

User variables can be defined on the fly, simply by assigning a value to a variable. There is no need to pre-define variables.

See the Assign command for an alternate syntax for assigning variable values.

See the Variables section for how to use variables in the script language.

See the System Variables section for a complete list of available system variables.

Examples

Set x 3
Sets the variable x to the number 3.

Set text "Hello World"
Sets the variable text to the string Hello World.

Set lcd.backlight 25
Sets the system variable lcd.backlight to 25%.

Set y ('x' + 1)
Sets the variable y to the result of the expression 'x' + 1.

See Also