5.0 Chapter Goals

The purpose of this chapter is to examine data types that have some kind of numeric ordering, whether that ordering is explicit or only implicit. Such types may consist of a sequence of discrete items that supply the possible values for variables of that type. These are called ordinal types, and include the whole number, character, and boolean types already encountered, as well as some new ones introduced in this chapter. On the other hand, the type may support variables that themselves consist of an ordered sequence of values with an explicit indexing scheme. On completing the chapter, the student should understand and be able to use the following:

Data Representation Abstractions

General:

ordinal data and indexed data

Realized in the Modula-2 notation:

ordinal types and their subranges, enumerated types, and arrays

Data Manipulation Abstractions

General:

a means of associating specific cardinals with the position a value occupies in an enumeration and vice-versa

Realized in the Modula-2 notation:

enumeration/cardinal conversion

Programming Abstractions

General:

iterations, nested loops

Realized in the Modula-2 notation:

the FOR loop as a variation on top-of-loop tested repetition for iterations


Contents