// Effectus auto-generated Mad Pascal source code listing
program loop_exitPrg;

uses
  Crt, StringUtils, SySutils, CIO;

var
  strBuffer : string;
var
  eff_loop_var : byte;
  eff_cnt : byte;
  eff_string : string;
// Effectus example:
// Using EXIT command in loop statements

procedure MAINProc;
var
  key : byte;  // key_byte_array
  n : byte;  // n_byte_array
begin
  Write(Chr(125));
  eff_string := '';
  Write('Effectus example:');  // Print 1
  Writeln;
  eff_string := '';
  Write('Using EXIT command in loop statements FOR,WHILE and UNTIL');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write('Counting from 1 to 10...');  // Print 1
  Writeln;
  Writeln('');
 FOR n:=1 to 10 do begin
  eff_string := '';
  Write(n);  // Print 2

  Write(Chr(44));
  if  n=7  then begin
  break;
  end;  // if
  end;
  Writeln('');
  eff_string := '';
  Write('Escaped from FOR loop!');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write('Counting from 1 to 20...');  // Print 1
  Writeln;
  Writeln('');
  n := 1;
  n := n+1;
 WHILE n<21 do begin
  eff_string := '';
  Write(n);  // Print 2

  Write(Chr(44));
  if  n=14  then begin
  break;
  end;  // if
  n := n+1;
  end;
  Writeln('');
  eff_string := '';
  Write('Escaped from WHILE loop!');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write('Counting from 1 to 6...');  // Print 1
  Writeln;
  Writeln('');
  n := 0;
  repeat
  Inc(n);
  eff_string := '';
  Write(n);  // Print 2

  Write(Chr(44));
  break;
 UNTIL n=6;
  Writeln('');
  eff_string := '';
  Write('Escaped from UNTIL loop!');  // Print 1
  Writeln;
  key := Get(7);
  ReadKey;
end;

begin
  MAINProc;
end.
