next up previous
Next: VAR Up: DECLARATIONS Previous: Procedural types

CONST

Constants are identifiers to which values are assigned at compiler time or at initial run time, as implemented in the TurboPascal extension of Pascal.

Compiler time declared constants cannot be the target of any assignment operation at run time. The declaration syntax for compiler time declared constants is:

<identifier> = <value>; where

<value> may be a constant expression of any type. The declared constant implicitly takes the same type.

Initial run time declared constants have their type explicitly declared and can be the target of assignment operation at run time.

The declaration syntax for initial run time declared constants is:

<identifier> : <type> = <list of values>;

Examples:

     CONST
     Flow: REAL = 30.7; Quantity: INTEGER = 12;
     ch: 'Y';
     Load: ARRAY[1..5] OF REAL = (3.8, 4.5, 4.2);
     Markov: ARRAY[1..3, 1..3] OF REAL = ((0.2, 0.4, 0.2),
                                          (0.7, 0.2, 0.3),
                                          (0.1, 0.4, 0.5));


domingo c
Mon Mar 20 11:09:25 PST 2000