# Add Variable

**Add Variable** node is designed to perform addition operations and store the result in a specified variable. This node can add a value to an existing variable.

### Properties Panel

| **Field**     | **Description**                                          | **Required** |
| ------------- | -------------------------------------------------------- | ------------ |
| Node name     | [Node Name](/flow-builder/node-name.md)                  | true         |
| Variable Name | The name of the variable where the result will be stored | true         |
| Value         | The value to be added                                    | true         |

### Usage

1. Specify a variable name whose value needs to be fetched and then the result will be stored.
2. Enter the value to be added.

### Behaviour

* If the specified variable doesn't exist, it will raise an error.
* If the variable already exists, the provided value will be added to the current value of the variable.

### Returns

The node stores the result of the addition in the specified variable. You can access this using Magical Autocomplete (e.g., `$.variables.<variable_name>`) in any node below this node.

### Example

Let's say you want to keep a count of processed items:

1. Set Variable name to `$.variables.processed_count`
2. Set Value to `1`

If the value of `processed_count` was `3`, it will now be `4`. If such variable doesn't exist, it'll raise an error.

### Best Practices

* Be aware of the data type of your variables. This node performs numeric addition, so non-numeric values may lead to unexpected results.
* Ensure that the variable is initialised earlier.


---

# 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.cosmocloud.io/flow-builder/node-types/variable-nodes/mathematical/add-variable.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.
