Next: , Previous: or, Up: Reference



Ord

Synopsis

     function Ord (ordinal_value): Integer;

Description

Ord returns the ordinal value of any ordinal variable or constant. For characters, this would be the ASCII code corresponding to the character. For enumerated types, this would be the ordinal value of the constant or variable (remember that ordinal value of enumerated constants start from zero).

Conforming to

Ord is defined in ISO 7185 Pascal and supported by all known Pascal variants.

Example

     program OrdDemo;
     var
       Ch: Char;
       Day: (Monday, Tuesday, Wednesday, Thursday, Friday);
     begin
       Ch := 'A';
       WriteLn (Ord (Ch));  { 65 }
       Day := Thursday;
       WriteLn (Ord (Day));  { 3 }
     end.

See also

Character Types, Ordinal Types, Chr, Char