Advanced features / Runtime stack |
When a value or a reference is popped from the stack, implicit data conversion takes place. This means, for example, that you can pass a string value to a function that defines the receiving variable as a numeric data type; no compilation error will occur, but you can get a runtime error if the string cannot be converted to a numeric. The same principle applies to values returned from functions, since the stack is also used in this case.
MAIN DEFINE s STRING LET s = "123" CALL display_integer(s) -- Will be accepted LET s = "abc" CALL display_integer(s) -- Will fail with conversion error END MAIN FUNCTION display_integer(x) DEFINE x INTEGER DISPLAY x END FUNCTION