March 2000
Intermediate to advanced
576 pages
18h 13m
English
Succ Function
function Succ(const Value): Ordinal type;The Succ function returns the successor of an
ordinal value, usually an enumerated value. That is, it returns the
enumerated value whose ordinal value is one more than
Value. Succ is not a
real function.
Inc, Succ, and addition by one
have similar performance, so choose the one that you find most clear
and easy to read.
Calling
Succ(High(
SomeType
))
raises runtime error 4 (ERangeError). Without
overflow checking, though, Succ returns a value
with the desired ordinal value, even though that value is not valid
for the type.
type TDay =
(Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
var
Day: TDay;
begin
Day := Succ(Day);
...| Dec Procedure, High Function, Inc Procedure, Low Function, Pred Function, $OverflowChecks Compiler Directive, $Q Compiler Directive |
Read now
Unlock full access