# Variable Editor

## Overview

The **Variable Editor** is used to add or edit a variable in a scope or a form's scripting file.

<figure><img src="/files/PSEP7JPOQJUmswsaY6WW" alt=""><figcaption><p>Variable Editor</p></figcaption></figure>

## Sections

### Name and Type selection

* **Name** : Enter the name for your variable in the `Name` field. Choose a name that is descriptive of the data it will hold.
* **Type** : Select the type of the variable from the "Type" dropdown. The options available in the screenshot include:
  * TEXT: for string values.
  * INTEGER: for whole numbers.
  * NUMBER: for numerical values, which can include decimals.
  * DATETIME: for date and time values.
  * MEDIA: for media objects, such as images or files.\
    Choose the type that best fits the kind of data you intend to store in the variable.

### Default value

* **Default value** : Specify the initial value for the variable.

You can choose between:

* **js expression**: Write a JavaScript expression that evaluates to the initial value of the variable.
* **value**: Manually enter a literal value.

### Buttons

* **OK** : Click this button to create the variable with the specified name, type, and default value.
* **Cancel** : Click this button to close the dialog without creating the variable.

## Example

If you want to create a variable to hold a string representing a user's name with an initial value of `John Doe`, you would:

1. Enter `userName` in the `Name` field.
2. Select `TEXT` from the `Type` dropdown.
3. Choose value and enter `John Doe` as the default value.
4. Click `OK` to create the variable.


---

# 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.servoy.com/reference/servoy-developer/object-editors/variable-editor.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.
