# Variables

There are three types of variables in Yate:

- Variable Fields
- Named Variables
- System Variables

Variable Fields are essentially per file fields which you can use within actions like any other field. These variables allow you to construct content to use within Yate without interfering with any of the standard fields. The Variable fields are not retained in the audio files. When you close a file all of the Variable fields are lost. When you first open a file or after saving a file the fields have an empty value. There are ten variable fields named: Variable 0, Variable 1, ..., Variable 9. The variables can also be accessed via Escape Sequences from text fields in actions. Basically to access a variable in a text field you use \v0 through \v9. Variables are only cleared when a file is loaded. Do not assume that they will be empty when an action starts. If you have previously run an action that may not be the case. These per file variables are the most accessible within action statements.

A Named Variable may consist of any character. They are not unique to each file but exist across all files. It is not a good idea to use > characters in the name as access will become difficult. Named variables are case insensitive. Named variables are set via the Set Named Variable action function and are read via Escape Sequences from text fields in actions. To specify a named variable in a text field the format is: \<name>. Named variables are useful as they give you the ability to store data without using up the more limited ten per file Variables and in the fact that they are unique across all files. Named variables tend to be more efficient than per file variables when you want a unique value across all open files. Named variables are erased when action processing terminates. This is either when an action run from the UI finishes or when a batch process finishes. Named variables can be manually removed by setting them to an empty value. When using named variables it is a good practice to initialize them before their first use, rather than assuming that they will be empty. However, all accesses to uninitialized named variables will return an empty value. The Insert Named Variable context menu provides an easy means of quickly accessing all used named variables across all open actions.

System Variables persist until cleared, even when Yate is closed. They are not unique to each file but exist across all files. System Variables may be examined and modified in Preferences - System Variables. System Variables may be cleared via the Clear All System Variables function. They are assigned via the Set System Variable function. They are read via Escape Sequences from text fields in actions. You access a system variable in a text field via \s0 through \s9.