Node: Ordinal Types, Next: Integer Types, Previous: Type Definition, Up: Data Types

#### Ordinal Types

An ordinal type is one that can be mapped to a range of whole numbers. It includes integer types, character types, enumerated types and subrange types of them.

A character type is represented by the intrinsic type `Char` which can hold elements of the operating system's character set (usually ASCII). Conversion between character types and integer types is possible with the intrinsic functions `Ord` and `Chr`.

An enumerated type defines a range of elements which are referred to by identifiers. Conversion from enumerated types to integer types is possible with the intrinsic function `Ord`. Conversion from integer to ordinal types is only possible by type-casting or using the extended form of `Succ`.

         var
           Foo: Char;       { foo can hold a character }
           Num: '0' .. '9'; { Can hold decimal digits, is a subrange type of Char }
           Day: (Monday, Tuesday, Wednesday, Thursday,
                 Friday, Saturday, Sunday);  { Can hold weekdays }

#### See also

Ord, Chr, Type Casts