CodeRunner MPL Documentation

For

Demonstrate how to implement a FOR loop.
procedure TestFor(Times: Int32);
begin
  for 1 to Times do
    WriteLn('hoi+')
  else
    WriteLn('No loop eh');

  for -1 downto Times do
    WriteLn('hoi-')
  else
    WriteLn('No loop eh');

  for 1 to Times with 2 do
    WriteLn('hoi++');
  for -1 downto Times with 2 do
    WriteLn('hoi--');
end;

var
  i: Int32;
begin
  for i := -2 to 2 do
  begin
    WriteLn('TestFor ', i, ': ');
    TestFor(i);
    WriteLn('');
  end;
end;
Output:
TestFor -2: 
No loop eh
hoi-
hoi-
hoi--

TestFor -1: 
No loop eh
hoi-
hoi--

TestFor 0: 
No loop eh
No loop eh

TestFor 1: 
hoi+
No loop eh
hoi++

TestFor 2: 
hoi+
hoi+
No loop eh
hoi++