• Reference Guide


Automatic Typecast

If a value of a certain type is required at a position of an expression and the actual value is of a different type, a weak type conversion is performed, if one is defined. For example in the expression:
var Real x = 5;
an integer (Int) constant is assigned to a real number (Real) variable. Though the two types are different, there is a weak type conversion defined between them. Therefore, the value being assigned is automatically converted to the required type.

Forced Typecast

If it is necessary to perform a strong type conversion or a weak type conversion is to be enforced, the typecast operator can be used. Its syntax is following:
For instance, if x is a real number, it is possible to convert it to a string with the expression [String]x. The expression that denotes the type need not be constant. Therefore, values of types that were dynamically constructed during the computation can be created this way.
Compound data types can be created using Data Type Functions.