summaryrefslogtreecommitdiff
path: root/sample.pas
blob: ac6c4adfbdd27a9ccd857896c2e7f3d6dbbcc8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
program HelloWorld(output);
begin
  Write('Hello, world!')
  {no ";" is required after the last statement of a block -
   adding one adds a "null statement" to the program;}
end.

procedure ThingOne;
begin
  while a <> b do  WriteLn('Waiting');

  if a > b then WriteLn('Condition met')   {no semicolon allowed!}
           else WriteLn('Condition not met');

  for i := 1 to 10 do  {no semicolon for single statements allowed!}
    WriteLn('Iteration: ', i);

  repeat
    a := a + 1
  until a = 10;

  case i of
    0 : Write('zero');
    1 : Write('one');
    2 : Write('two');
    3,4,5,6,7,8,9,10: Write('?')
  end;
end.