> For the complete documentation index, see [llms.txt](https://docs.roboteasy.tech/studio-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboteasy.tech/studio-en/studio/objetos/blocos-de-comando/atribuir-valor-variavel.md).

# Assign Value to Variable

Object to assign value to an existent variable.

## Settings

To use this object it's necessary to select the variable and enter the desired value.

<figure><img src="https://1031980850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq5KHpWgHEwo0MpHCFtAb%2Fuploads%2Fk2Jj2qODyqwdlnFVDnCa%2Fimage.png?alt=media&amp;token=80616150-0b10-448e-a02c-9cdb38ed3bde" alt=""><figcaption><p>General object layout</p></figcaption></figure>

**Filling in the object:**

| Field            | Description                                                                                                                                                                           |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Title            | It's the object's name and doesn't need to be changed, unless you want to identify it to make it easier to find on the robot, for example: "Assign Variable Value - New Information". |
| Select Variables | Name of an already declared variable.                                                                                                                                                 |
| Variable Value   | New value to be replaced in the variable.                                                                                                                                             |
| Add Variable     | Option to place the value in more variables.                                                                                                                                          |

{% hint style="info" %}
**INTERPOLATION**

This is a technical concept used in programming and you don't need to worry about changing it at this point.
{% endhint %}

## WHAT ARE VARIABLES

Variables are important structures in any programming, regardless of the language used to implement the codes or programs. They can be understood as a box, where data is stored temporarily or permanently and which is manipulated during the execution of the program.&#x20;

Source: usp.br

## PREREQUISITES

* Note that it's possible to assign a value to any variable created within the robot, but one of the most common prerequisites would be to use the [Declare Variable](/studio-en/studio/objetos/blocos-de-comando/declarar-variavel.md) object.

## USE CASES

* Use it to assign a value to a variable.&#x20;
* Storing data efficiently to be used in the correct execution of the robot.&#x20;
* More efficient handling in robot configuration.

## Example

Declare a variable and assign a value using a message box to view it.

<details>

<summary>ITEMS USED IN THE ROBOT</summary>

* **Objects:** [Declare Variable](/studio-en/studio/objetos/blocos-de-comando/declarar-variavel.md) -[ Message Box](/studio-en/studio/objetos/acoes-globais/caixa-de-mensagem.md)

</details>

**STEP 1:** To set Declare Variable.&#x20;

<figure><img src="https://1031980850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq5KHpWgHEwo0MpHCFtAb%2Fuploads%2F9jVycIt8mLBCtBKu0gX7%2Fimage.png?alt=media&amp;token=185812cb-ae01-4a5c-be9f-3f4e4015e5bc" alt=""><figcaption><p>Declare Variable setting</p></figcaption></figure>

**STEP 2:** To set Assign Variable Value.&#x20;

<figure><img src="https://1031980850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq5KHpWgHEwo0MpHCFtAb%2Fuploads%2FeCWZRlM8SgCbUvcWQ6Am%2Fimage.png?alt=media&amp;token=047388f4-7aa6-49bf-b2e7-ad8961652878" alt=""><figcaption><p>Assign Variable Value setting</p></figcaption></figure>

**STEP 3:** To set Message Box.&#x20;

<figure><img src="https://1031980850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq5KHpWgHEwo0MpHCFtAb%2Fuploads%2FTGH1YZYSUJrEdLzhfpg3%2Fimage.png?alt=media&amp;token=7267ac77-8c27-4262-a290-982a29246d70" alt=""><figcaption><p>Message Box setting</p></figcaption></figure>

**STEP 4:** Run the robot and check the actions.

<figure><img src="https://1031980850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq5KHpWgHEwo0MpHCFtAb%2Fuploads%2FpDdJG6SCMMvfppwg1ywt%2Fassign%20variable%20value.gif?alt=media&amp;token=c467b767-628e-4a9b-b64d-c1dfb6d3cf47" alt=""><figcaption><p>Successful robot example execution - Assign Variable Value</p></figcaption></figure>

## Download It

{% file src="/files/JdQjeNfA7YOCfpTd1CWj" %}
