# 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="https://3933488479-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpWd52BKwABWxF2lScUK%2Fuploads%2Fgit-blob-3768e8e549809a036f25696ab01949faffc6d483%2Fnew-variable-editor.jpg?alt=media" 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.
