> For the complete documentation index, see [llms.txt](https://docs.uniot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uniot.io/platform/sandbox/visual-editor/variables.md).

# Variables

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

{% hint style="info" %}
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.
{% endhint %}

## set

<div align="left"><figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-23a715c0335a2f783d05c5ad95a7b09a2f2bda83%2Fvariables_set.png?alt=media" alt=""><figcaption></figcaption></figure></div>

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:**

<figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-8b438e909adbd8c3de0d71d973658a79f12655d3%2Fvariables_set_example.png?alt=media" alt=""><figcaption><p>Setting variables</p></figcaption></figure>

## get

<div align="left"><figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-2d93117e5511cffe6e26386e049feb21b430cb53%2Fvariables_get.png?alt=media" alt=""><figcaption></figcaption></figure></div>

Retrieves the current value stored in a variable.

**Parameters:**

* **Variable**: Select which variable to read

**Returns:**

* **Any**: The current value of the variable

**Example:**

<figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-df4bd67552aef5f35e37acf52730280380a25bd7%2Fvariables_get_example.png?alt=media" alt=""><figcaption><p>Getting variable values</p></figcaption></figure>

## change

<div align="left"><figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-bef2f45f59713191f2854bfec46d7c225ab6e112%2Fvariables_change.png?alt=media" alt=""><figcaption></figcaption></figure></div>

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:**

<figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-2e9dca20d139db11dfbe2e2e8fdd1d879df05cee%2Fvariables_change_example.png?alt=media" alt=""><figcaption><p>Modifying variables</p></figcaption></figure>

## Managing Variables

<div align="left"><figure><img src="https://1776027180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsSE1iwGRAGqUrb5YXfFa%2Fuploads%2Fgit-blob-e88b8cb79d4ea378e051cb3a63befe9b75a764a3%2Fvariables_dropdown.png?alt=media" alt=""><figcaption></figcaption></figure></div>

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)

{% hint style="warning" %}
Renaming or deleting a variable affects **all blocks** that use it. Be careful when modifying variables used in multiple places.
{% endhint %}
