The TVariable Basics

TScript implements only one variable and that is the TVariable. This variable can take several different forms including standard variables, arrays and classes.

The standard variables can be formed as fixed data such as a Boolean, Integer or Decimal and a variable length variable such as an ASCII string, wide character string or a binary string. The type of the data can be used to define variable or the type can be explicitly declared, so for example the code - "variable myInteger = 0;" will create a variable called myInteger and assign it the value of zero. An Integer type can also be declared as - "Integer myInteger;" and its default value will be set to zero.

The TVariable type is also transient as an Integer can be changed into an AString by assigning it a string value or by casting the variable to an AString. For example after an integer variable has been created and used, it can be reassigned by equating it to an AString.

TVaribles can also be used to hold an array of TVaribles. Once a valid variable has been created, the array index subscripting notation can be used to transform it into an array, so for example the code - "variable list = {0,2,4,6};" will create an array with four elements. The TVariable type for "list.type" will be that of a structure and each element of "list[0].type" will be an Integer.

Class in TScript are similar to array in how TVarible handle them, but use strings as array scriptures. For example the code - "variable list = {"Monday" =>; true, "Tuesday" => false};" will create a structured variable where list. Monday is true and list.Tuesday is false. In the native C++ code, structured TVariable elements are accessible by - list["Monday"].