RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.Succ Function

Returns the successor of an argument.

Pascal
procedure Succ(X);
C++
Succ( X);

System

In Delphi code, Succ returns the successor of the argument, X. 

X is an expression of an ordinal type (including Int64). The result, of the same type as X, is the successor of X.  

Delphi Examples: 

 

{
This example demonstrates how Pred and Succ can be used to
manage enumerations.
}
procedure TForm1.Button1Click(Sender: TObject);
type
  Colors = (RED,BLUE,GREEN);
var
  S: string;
begin
  S := 'The predecessor of 5 is ' + IntToStr(Pred(5)) + #13#10;
  S := S + 'The successor of 10 is ' + IntToStr(Succ(10)) + #13#10;
  if Succ(RED) = BLUE then
    S := S + 'In the type Colors, RED is the predecessor of BLUE.';
  MessageDlg(S, mtInformation, [mbOk], 0, mbOk);
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!