Node:Ord, Next:or else, Previous:or, Up:Reference
function Ord (ordinal_value): Integer;
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).
Ord is defined in ISO 7185 Pascal and supported
by all known Pascal variants.
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.