CS 3304: Comparative Languages
Data Types
[
Course Documents
] : [
Data Types
]
Previous
Contents
Next
Keyword Index
Subrange Types
An ordered, contiguous subsequence of another ordinal type
Design Issue: How can they be used?
Examples:
Pascal--subrange types behave as their parent types; can be used as for variables and array indices
type pos = 0 .. MAXINT;
Ada--subtypes are not new types, just constrained existing types (so they are compatible); can be used as in Pascal, plus case constants
subtype Pos_Type is Integer range 0 ..Integer'Last;