Language basics / Type conversions |
The runtime system performs data conversion implicitly without objection, as long as the data conversion is valid. For example, a number expression can be assigned to a character variable; The runtime system converts the resulting number to a literal string:
MAIN DEFINE d DECIMAL(10,2), v VARCHAR(50) LET d = 1234.50 * 2 LET v = d DISPLAY v -- displays 2469.00 END MAIN
Conversion rules apply to variable assignment, function parameters, and returned values:
MAIN DEFINE d DECIMAL(10,2), v VARCHAR(50) LET d = 1234.50 * 2 LET d = func(d) DISPLAY d -- displays 2469.00 (with leading blanks) END MAIN FUNCTION func(v) DEFINE v VARCHAR(50) DISPLAY v -- displays 2469.00 RETURN v END FUNCTION