====== CONST ====== [pet] [vic20] [c64] [c16] [cplus4] [c128] [x16] [m65] The const directive defines a constant. Constants are named values that exist in compile-time only and are replaced with their numeric value in runtime. ===== Syntax ===== [SHARED] CONST [AS ] = The 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. A constant declared with `AS ` is typed and behaves like a variable of that type in expressions. Constants have the same [[variables#variable_scope|visibility options]] as variables. ===== Examples ===== ' -- Constants can be used to improve the readability of your code CONST BORDER = $d020 CONST BLACK = 0 POKE BORDER, BLACK