10.8 Const statement

 
Const #<name> = <expr>

The Const statement allows you to declare a new constant. The name you specify in name must be prefixed with a hash character (#). expr must be a constant (!) expressions, i.e. you must not use any variables here. For example:

 
Const #MYCONSTANT  = (5 * 10) / 2      ; #MYCONSTANT  = 25
Const #MYCONSTANT2 = #MYCONSTANT * 10  ; #MYCONSTANT2 = 250
Const #MYCONSTANT3 = b * 5             ; does not work!

The last example will not work because a variable is used and the expression must be constant.

Alternatively, expr can also be a constant string expression. E.g.

 
Const #PRGVERSTRING = "$VER: MyProgram 1.0 (13.04.2005)"

Constants can also be declared from the command line by using the -setconstants console argument. This is especially useful in connection with the @IF preprocessor command. See Console arguments for details.


Show TOC