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.
|Use with caution.|
|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|
| Download this web site as a Windows program.
|Example code : Skipping loop processing for certain loop values|
i : Integer;
s : string;
s := '';
// A big loop
for i := 1 to 9 do
// Skip loop processing for certain values of i
if (i = 3) or (i = 7) then Continue;
s := s + IntToStr(i);
s := s + ' ';
// Show the string created by the above loop
ShowMessage('s = '+s);
|Show full unit code|
| s = 1 2 4 5 6 8 9|