DelphiBasics
Continue
Procedure
Forces a jump to the next iteration of a loop System unit
 procedure Continue ;
Description
The Continue procedure forces a jump past the remaining statements within a loop, back to the next loop iteration. Like the Goto statement, it should be used with caution.
 
It is important to note that the Continue statement only jumps to the start of the current loop - not out of any nested loops above it. The Goto statement can.
Notes
Use with caution.
Related commands
Break Forces a jump out of a single loop
For Starts a loop that executes a finite number of times
Goto Forces a jump to a label, regardless of nesting
Repeat Repeat statements until a ternmination condition is met
While Repeat statements whilst a continuation condition is met
Abort Aborts the current processing with a silent exception
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Skipping loop processing for certain loop values
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  i : Integer;
  s : string;

begin
  s := '';

  // A big loop
  for i := 1 to 9 do
  begin
    // Skip loop processing for certain values of i
    if (i = 3) or (i = 7) then Continue;
    s := s + IntToStr(i);
    s := s + ' ';
  end;

  // Show the string created by the above loop
  ShowMessage('s = '+s);
end;
 
end.
Hide full unit code
   s = 1 2 4 5 6 8 9
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page