Table of Contents

CONST

PET VIC-20 C64 C16 Plus/4 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 <name> = <value>

The <value> must be a numeric literal.

Constants themselves do not have a type. The type of the numeric literal will be used when a constant is used in an expression.

Constants have the same visibility options as variables.

Examples

REM -- Constants can be used to improve the readability of your code
CONST BORDER = $d020
CONST BLACK = 0
POKE BORDER, BLACK