# 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="/files/rQ4Jgrok6bhoGyZE75sT" 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="/files/WKJzri80OSx6BnxKUZJd" alt=""><figcaption><p>Setting variables</p></figcaption></figure>

## get

<div align="left"><figure><img src="/files/qZMjTT9XPA0apdePU6Q4" 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="/files/tlw4AbdH5IOk5FEEmN3G" alt=""><figcaption><p>Getting variable values</p></figcaption></figure>

## change

<div align="left"><figure><img src="/files/12igOiFypCraHNfz1Opi" 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="/files/h9UawPepEhdxaQdwMIiQ" alt=""><figcaption><p>Modifying variables</p></figcaption></figure>

## Managing Variables

<div align="left"><figure><img src="/files/4yDPoeeWeyflI345qS6S" 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uniot.io/platform/sandbox/visual-editor/variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
