next up previous contents index
Next: Typed constants Up: Constants Previous: Constants

Ordinary constants

Ordinary constants declarations are no different from the Turbo Pascal or Delphi implementation.


Constant declaration

syntdiag837
The compiler must be able to evaluate the expression in a constant declaration at compile time. This means that most of the functions in the Run-Time library cannot be used in a constant declaration. Operators such as +, -, *, /, not, and, or, div(), mod(), ord(), chr(), sizeof can be used, however. For more information on expressions, chapter (gif)

You can only declare constants of the following types: Ordinal types, Real types, Char, and String. The following are all valid constant declarations:
listing814
Assigning a value to a constant is not permitted. Thus, given the previous declaration, the following will result in a compiler error:
listing820


next up previous contents index
Next: Typed constants Up: Constants Previous: Constants

Michael Van Canneyt
Fri Sep 25 09:15:40 MEST 1998