Type Casting

Explicit type convertion of a value expression into a specific Data Type. This is often makes sense when a Function requires a specific data type. Some output functions adapt the display format ti the data type passed.

For example the calculation of a bit manipulation will result in the next larger data type if the original data type possibly may not have enough space to accomodate the result (Data types smaller than Long).

Example 1:

dim a,b as byte
print hex(a+b)  ' The result will be a Word,
                ' the Hex-Output function will therefor display a Word value

You could force a type conversion to define the resulting data type.

Type Conversion Functions

See also:

Example 2:

dim a,b as byte
print hex(byte(a+b))  ' The result will be of type Byte,
                      ' the Hex-Output function will therefor display a Byte value