Contents | Prev | Next | Index


Enumerations

An enumeration is a list of identifiers that denote values. Each value belongs to that list which constitutes a data type. These identifiers are used as manifest constants in the program. Only they, and no other values, belong to that data type. The values are ordered, with the ordering relation being defined by their sequence in the enumeration. The ordinal number of the first value is 0.

enumeration ::= ( enum_list )
enum_list   ::= enum_list , <identifier>
            ::= <identifier>

Examples:

(red, green, blue)

(club, diamond, heart, spade)

(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)


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