contents   index   previous   next

Conversion or casting


Though ScriptEase does well in automatic data conversion, there are times when the types of variables or data must be specified and controlled. Each of the following casting functions, the functions below that begin with "To", has one parameter, which is a variable or piece of data, to be converted to or cast as the data type specified in the name of the function. For example, the following fragment creates two variables.


var aString = ToString(123);

var aNumber = ToNumber("123");


The first variable aString is created as a string from the number 123 converted to or cast as a string. The second variable aNumber is created as a number from the string "123" converted to or cast as a number. Since aString had already been created with the value "123", the second line could also have been:


var aNumber = ToNumber(aString);


The type of the variable or piece of data passed as a parameter affects the returns of some of these functions.