qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CONST Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Declares one or more symbolic constants.
 
CONST constantname = expression [,constantname = expression]...
 
    ■ constantname    The name of the constant. This name can consist of up
                      to 40 characters and must begin with a letter. Valid
                      characters are A-Z, 0-9, and period (.).
    ■ expression      An expression that is assigned to the constant. The
                      expression can consist of literals (such as 1.0), other
                      constants, any arithmetic or logical operators except
                      exponentiation (^), or a single literal string.
 
Example:
    CONST PI = 3.141593
    INPUT "Radius of Circle: "; r
    PRINT "Area = "; PI * r ^ 2