在迴圈中打破並繼續
program ForLoopWithContinueAndBreaks;
{$APPTYPE CONSOLE}
var
var i : integer;
begin
for i := 1 to 10 do
begin
if i = 2 then continue; (* Skip this turn *)
if i = 8 then break; (* Break the loop *)
WriteLn( i );
end;
WriteLn('Finish.');
end.
輸出:
1
3
4
5
6
7
完成。