Variables and Type Conversions

Occasionally, data may be the wrong type. For example, an addition may be performed on two variables, one containing a number, the other containing a text value. VTS handles this situation by performing a conversion of the unexpected data to the type of data anticipated.

A = 5

B = “4”

C = A + B

In this example, two numbers are expected. One variable is already a number; the other variable containing text is converted by VTS to a number. This is done by reading an ASCII number from the text. If successful, the converted number is used; if unsuccessful, an invalid value is returned. This process is referred to as "type conversion".

For a complete list of all type conversions, see Value and Type Conversions.

Note When two variables of different type are used in an expression, the second operand will always be cast to the type of the first.  This can cause radically differing results depending on the order of the operands.