contents   index   previous   next



Data types

 

Data types in ScriptEase can be classified into three groupings: primitive, composite, and special. In a script, data can be represented by literals or variables. The following lines illustrates variables and literals:

 

var TestVar = 14;

var aString = "test string";

 

The variable TestVar is assigned the literal 14, and the variable aString is assigned the literal "test string". After these assignments of literal values to variables, the variables can be used anywhere in a script where the literal values could to be used.

 

In the fragment above which defines and uses the function SumTwo(), the literals, 3 and 4, are passed as arguments to the function SumTwo() which has corresponding parameters, a and b. The parameters, a and b, are variables for the function the hold the literal values that were passed to it.

 

Data types need to be understood in terms of their literal representations in a script and of their characteristics as variables.

 

Data , in literal or variable form, is assigned to a variable with an assignment operator which is often merely an equal sign, "=" as the following lines illustrate.

 

var happyVariable = 7;

var joyfulVariable = "free chocolate";

var theWorldIsFlat = true;

var happyToo = happyVariable;

 

The first time a variable is used, its type is determined by the interpreter, and the type remains until a later assignment changes the type automatically. The example above creates three variables, each of a different type. The first is a number, the second is a string, and the third is a boolean variable. Variable types are described below. Since ScriptEase automatically converts variables from one type to another when needed, programmers normally do not have to worry about type conversions as they do in strongly typed languages, such as C.

 


Primitive data types

Composite data types

Special values