Continue
From Free Pascal wiki
Jump to navigationJump to search
│
Deutsch (de) │
English (en) │
The modifier continue
belongs to the loop commands.
The continue
statement moves the loop immediately to the next iteration of the loop.
It can be used in any of the loop control structures (eg.
while
..do
,
repeat
..until
, and
for
).
program ContinueProject;
uses sysUtils;
Const
arr :array[1..10] of integer=(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
var
i, sum :integer;
s:string;
begin
sum := 0;
s := '';
for i in arr do
begin
if odd(arr[i]) then continue;
if s<>'' then s := s + ' + ';
sum := sum + arr[i];
s := s + IntToStr(arr[i]);
end;
writeln;
writeln (s);
writeln ('Sum of even numbers: ', sum);
readln;
end.