# Variables

## Introduction

The Variables tab displays the variables for the currently-selected element, instance, or behavior. The variables tab displays the effective value of all variables for the selected object and provides controls for changing these variables.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-28703b5cf8adcd004da463c97d82d5f91d93f794%2FVariablesTab.png?alt=media" alt=""><figcaption><p>Variables for the ExitButton instance</p></figcaption></figure>

## Default and Explicitly Set Values

Gum helps you visualize which variables are explicitly set at the current selection level. If a variable is not explicitly set, then it inherits the value from the next level down.

Standard elements explicitly set their values on their Default state, which means all values have a white background. The following image shows default values for the ColoredRectangle standard element.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-2eaed3ef9775f54376113e236878e6b10a1eb39b%2F14_09%2017%2015.png?alt=media" alt=""><figcaption><p>All values explicitly set on a a ColoredRectangle</p></figcaption></figure>

By contrast, if a ColoredRectangle is dropped into a Screen or Component, this creates an instance. Most of its variables on the instance are not explicitly set so they show up with a green background. For example, the ColoredRectangleInstance in the following image has its `Width` and `Height` variables set to `50`. This is the default value for `Width` and `Height` obtained from the ColoredRectangle standard element.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-72e39c582bac02a776fa9088f17a9e84cb356e18%2F15_04%2019%2028.png?alt=media" alt=""><figcaption><p>Most variables are not explicitly set, so they have a green background</p></figcaption></figure>

If a variable is set, then its value is updated and its background changes from green to white. Notice that variables can be set by typing in values, clicking on icons, dragging over the labels, or changing the value in the editor tab.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-a0874ccc7acbbd33876466332a374742559484d4%2F15_04%2022%2036.gif?alt=media" alt=""><figcaption><p>Setting values changes the background from green to white</p></figcaption></figure>

## Setting Variables to Default

A changed variable can be restored to default.

Any change can be undone with the CTRL+Z key combination if the variable was previously set to its default value. The undo history can be viewed in the History tab which updates as changes are made or as undo's are applied.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-02aa395112d5b5e8050de77d8805210de6e33691%2F15_04%2027%2013.gif?alt=media" alt=""><figcaption><p>If a variable was previously its default value, an undo restores the default value</p></figcaption></figure>

Variables can be set to default by right-clicking on the variable in the Variables tab and selecting the **Make Default** option.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-409cfba397287eefe41105178cdd3f36594ad934%2F15_04%2029%2004.gif?alt=media" alt=""><figcaption><p>Make Default right click option restores a variable to its default value</p></figcaption></figure>
