Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Ord Function
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
ordinal_value Ordinal expression
Returns
LongInt Ordinality of ordinal_value in set of scalar
values
Description
The Ord function returns a LongInt containing the ordinality of
ordinal_value within the range of scalar values for the ordinal
type of ordinal_value.
The numbering of an enumerated type begins at zero for the first
element. For the last element, Ord returns a value one less than
the number of elements. For example, if an enumerated type MyType
has three elements, Ord returns a value of 2 from the call
result := Ord( Last( MyType ) );
Ord returns an ASCII code when passed a character. The Chr function
operates as the inverse of Ord, returning the character represented
by a given ASCII value. For example, to return the ASCII value of
the letter 'A':
result := Ord( 'A' );
The ordinality of a value of integer type is equal to that value.