Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
const [2026/10/08 20:04] – [Syntax] neilsconst [2026/10/08 20:04] (current) – [Syntax] neils
Line 13: Line 13:
 The <value> must be a numeric literal or an expression that only contains numeric literals or other constants. The <value> must be a numeric literal or an expression that only contains numeric literals or other constants.
  
-Numeric literals and ''CONST'' values defined without an explicit type are untyped. An untyped constant adapts to the type of the other operand, e.g. ''b + 1'' is a ''BYTE'' operation if ''b'' is a ''BYTE''. If the constant does not fit in that type, the operation is  promoted to the smallest type that can hold both, e.g. ''b + 300'' is a ''WORD'' operation and ''b * -1'' is an `INT` operation.+Numeric literals and ''CONST'' values defined without an explicit type are untyped. An untyped constant adapts to the type of the other operand, e.g. ''b + 1'' is a ''BYTE'' operation if ''b'' is a ''BYTE''. If the constant does not fit in that type, the operation is  promoted to the smallest type that can hold both, e.g. ''b + 300'' is a ''WORD'' operation and ''b * -1'' is an ''INT'' operation.
  
 A constant declared with `AS <type>` is typed and behaves like a variable of that type in expressions. A constant declared with `AS <type>` is typed and behaves like a variable of that type in expressions.