Variables

Variables store and manage data in your scripts. Use variables to track changing values like sensor readings, counters, states, or calculated results.

Create variables through the Variables section in the toolbox before using them. Variable names are case-sensitive - choose meaningful names to make your code easier to understand.

set

Assigns a value to a variable. If the variable doesn't exist, it's created automatically.

Parameters:

  • Variable: Select from the dropdown or create a new variable

  • Value (Any): The value to store

Example:

Setting variables

get

Retrieves the current value stored in a variable.

Parameters:

  • Variable: Select which variable to read

Returns:

  • Any: The current value of the variable

Example:

Getting variable values

change

Increments or decrements a numeric variable by adding a value to it. Use negative values to subtract.

Parameters:

  • Variable: Select which variable to modify

  • Value (Number): The amount to add (use negative for subtraction)

Example:

Modifying variables

Managing Variables

The variable dropdown menu in each block provides options to:

  • Select existing variables from your script

  • Rename the selected variable (updates all references)

  • Delete the selected variable (removes from all blocks)

Last updated