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

uses
  Crt, StringUtils, SySutils, CIO;

var
  strBuffer : string;
var
  eff_loop_var : byte;
  eff_cnt : byte;
  eff_string : string;
// Effectus example:
// PROCedure and variable scope
var
  key : byte;  // key_byte_array
  cvar : word;  // cvar_byte_array

procedure TEST01Proc;
begin
  eff_string := '';
  Write('Hello there 01');  // Print 1
  Writeln;
end;

procedure Test02Proc(n : byte);
var
  ii : integer;  // ii_byte_array
begin
  eff_string := '';
  Write('Hello there 02');  // Print 1
  Writeln;
  Write(Chr(n));
  eff_string := '';
  Write('ello there 03');  // Print 1
  Writeln;
  ii := -1230;
  eff_string := '';
  Write(ii);  // Print 2
  Writeln;
end;

procedure Test03Proc(n : byte; cc : word);
begin
  eff_string := '';
  Write(n);  // Print 2
  Writeln;
  eff_string := '';
  Write(cc);  // Print 2
  Writeln;
  cvar := 65000;
  n := 10;
  cc := 50000;
  eff_string := '';
  Write(n);  // Print 2
  Writeln;
  eff_string := '';
  Write(cc);  // Print 2
  Writeln;
end;

procedure MAINProc;
var
  X : word;  // X_byte_array
  Y : word;  // Y_byte_array
begin
  Write(Chr(125));
  eff_string := '';
  Write('Hello world');  // Print 1
  Writeln;
  X := 30;
  Y := 50;
  X := X * 20;
  eff_string := '';
  Write(X);  // Print 2
  Writeln;
  X := X * Y;
  eff_string := '';
  Write(X);  // Print 2
  Writeln;
  TEST01Proc;
  TEST02Proc(72);
  TEST03Proc(7, 2355);
  key := Get(7);
  ReadKey;
end;

begin
  MAINProc;
end.
