Difference between revisions of "Continue"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "{{Continue}} The reserved word <syntaxhighlight lang="pascal" enclose="none">continue</syntaxhighlight> belongs to the loop commands. The <syntaxhighlight l...")
 
Line 1: Line 1:
 
{{Continue}}
 
{{Continue}}
  
The [[Reserved word|reserved word]] <syntaxhighlight lang="pascal" enclose="none">continue</syntaxhighlight> belongs to the loop commands.
+
The [[modifier|modifier]] <syntaxhighlight lang="pascal" enclose="none">continue</syntaxhighlight> belongs to the loop commands.
 
The <syntaxhighlight lang="pascal" enclose="none">continue</syntaxhighlight> [[statement|statement]] moves the loop immediately to the next iteration of the loop.
 
The <syntaxhighlight lang="pascal" enclose="none">continue</syntaxhighlight> [[statement|statement]] moves the loop immediately to the next iteration of the loop.
 
It can be used in any of the loop control structures (eg.  
 
It can be used in any of the loop control structures (eg.  

Revision as of 20:35, 12 July 2019

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.


see also