ArcBasicDocs

Constants

A constant is a name for a value that never changes. Make one with Const, giving its value straight away:

Const SCREEN_W = 800, SCREEN_H = 600Const GRAVITY# = 0.35Const TITLE$ = "Star Catcher"Graphics SCREEN_W, SCREEN_H, 0, 2AppTitle TITLE$

Names make a program easier to read than bare numbers, and when a value needs adjusting, it only needs changing in one place. Constants can be used anywhere in the program, inside functions too, wherever the value itself could go, including as the default value of a function's parameter. Trying to change one is an error.

The value has to be something ArcBasic can work out before the program runs: numbers, strings, other constants and the operators between them, such as Const HALF_W = SCREEN_W / 2.

Built-in constants

ArcBasic comes with named constants for the numbers that commands use, such as KEY_SPACE for the space bar's scancode or MOUSE_LEFT for the left mouse button. They are listed on the built-in constants page of the command reference. True (1), False (0) and Pi (3.14159...) are also always there.