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
BreakForces a jump out of a single loop
ForStarts a loop that executes a finite number of times
GotoForces a jump to a label, regardless of nesting
RepeatRepeat statements until a ternmination condition is met
WhileRepeat statements whilst a continuation condition is met
AbortAborts the current processing with a silent exception
 Download this web site as a Windows program.




 
Example code : Skipping loop processing for certain loop values
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;
Show full unit code
  s = 1 2 4 5 6 8 9
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page