# setVar

## Description

Creates a global variable with a value associated to it.

## Input / Parameter

| Name  | Description                           | Input Type  | Default | Options | Required |
| ----- | ------------------------------------- | ----------- | ------- | ------- | -------- |
| var   | The name of the variable to create.   | String/Text | -       | -       | Yes      |
| value | The value associated to the variable. | String/Text | -       | -       | Yes      |

## Output

| Description                                | Output Type |
| ------------------------------------------ | ----------- |
| Returns the value of the variable created. | String/Text |

## Callback

N/A

## Video

Coming Soon.

## Example

### Steps

1. Drag the `setVar` function into the flow window. ![](/files/nkaB6hqAmxbIivzdhk1m)
2. Create a variable called `version` with the value `1.0.0` ![](/files/MSmk7ao2M34yMW68nNVI)
3. This will create a global variable called "version" containing the value "1.0.0" that can be accessed by other components or on other pages of your app.

### Result

The value of the global variable `version` can be accessed by using the [`getVar`](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/006-actions-and-visual-logic/action-reference/cordova/App/setVar/getvar/README.md) function.

![](/files/XxyD6kI99F9NadGUEuKX)

Using the above flow will display the value `1.0.0` in the browser console.

![](/files/pNTVwwS6SE1hHl236D7k)

## Links

* See also [`getVar`](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/006-actions-and-visual-logic/action-reference/cordova/App/setVar/getvar/README.md)


---

# 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.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/app/setvar.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.
