Variable Typing and Conversion
• Variables and fields may be (floating point) numbers, or strings, or both.
• The way a variable is interpreted depends on the way it is used. If a variable is assigned a numeric value, it will be treated as a number. If a variable is assigned a string value, it will be treated as a string.
Example
• All variables start out as string variables until a value is assigned. To force a variable to be treated as a number, assign it a numeric value. This is usually done in the begin block (refer to the BEGIN pattern in the Patterns section for more information):
Comparisons written in CXL are performed as follows:
• If both expressions to the left and right of the comparison operator evaluate to a string then a string comparison is made.
• A numeric comparison is performed if one or both of the expressions evaluate to a number.
• In comparisons, uninitialized variables have the numeric value 0 and the string value "" (the null, or empty, string).
Last modified date: 02/01/2024