Next: Assignments, Previous: Rewrite expressions, Up: Full Syntax Description [Contents][Index]
The type coercion is like a type cast in C. Its syntax is
‘(’ type ‘)’ ident
Type coercion associates left, and has the same precedence as unary negation operators (i.e. the highest one).
The result of type coercion is as follows:
| type | Variable type | Resulting conversion |
| integer | integer | No conversion. This results in the same integer value. |
| integer | string | If the string value of the variable is a valid ASCII representation of the integer number (either decimal, octal, or hex), it is converted to the integer; otherwise the result of the conversion is undefined. |
| string | integer | The ASCII representation (in decimal) of the integer number. |
| string | string | No conversion. This results in the same string value. |