In simple terms, a variable is a named storage location in your PC's memory where a value can be stored. The term "variable" is used, as the value stored in the named storage location can change over time (i.e. the stored value is variable or changing).
Variable names can be up to 256 characters in length to allow descriptive labeling of the information that they contain. In earlier versions of VTS, there was a limit of 16,384 variables in any given module. The limit is currently 4,194,304 variables per module.
All of the data in VTS is stored in variables. Data values come in a variety of different types, the most common types being numbers and text. VTS also uses many other data types such as Boolean values, pointers, streams, objects and graphic values. A variable can also represent an entire collection of values stored as an array or as a dictionary. Any variable can hold any type of value.
An example showing values being assigned to variables is displayed below:
Title = "Station 009";
Color = 15;
In the preceding example, the variables specify the text and background color for a system page.
Unlike most programming languages, VTS variables do not have a data type. The data type is associated with the value stored by the variable so that the type can change as the value changes. This feature is called "dynamic typing". In a dynamic language, such as VTS, a programmer can create variables without specifying their type. This creates programs that are more flexible and can simplify object-oriented coding. In a static programming language, a programmer must declare the type of each variable before compiling the code, thus making the code less flexible. The benefit of dynamic typing is that there is no need to deal with data whose type cannot be determined at compile time.
VTS has a feature called "event-driven execution". Event-driven execution is based upon a response to an event. In VTS, events occur when there is a change in value of any variable. Whenever a variable's value changes, only the statements that use that variable are recalculated. Limiting the number of recalculations to only those that are necessary greatly increases the speed of the system. This feature is referred to as being in "steady state".
To use the value contained in a variable in a statement, you simply need to specify the name of the variable.
More detailed information on variables can be found in the topic: Variables.