Contents | Prev | Next | Index


Constant Declarations

A constant  associates an identifier with a constant value.

const_decl ::= const_def
const_def  ::= <identifier> = const_expr
const_expr ::= expr

A constant expression is an expression that can be evaluated during compilation by a mere textual scan without actually executing the program. Its operands are constants or standard functions that can be evaluated at compile time.

The standard constant identifier NIL is a zero pointer value. It is compatible with any other pointer type. If the language extensions are enabled via a compiler switch or directive, it is also compatible with any procedure type.

Examples of constant declarations are:

  N = 100
  limit = 2*N - 1
  fullSet = {0..SIZE(BITSET)*8-1}


Contents | Prev | Next | Index

Canterbury Modula-2 for Java  (Last documentation update Feb 8, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com