~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to docs/refex/ex21.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Program Example21;
2
 
 
3
 
{ Program to demonstrate the Exit function. }
4
 
 
5
 
Procedure DoAnExit (Yes : Boolean);
6
 
 
7
 
{ This procedure demonstrates the normal Exit }
8
 
 
9
 
begin
10
 
  Writeln ('Hello from DoAnExit !');
11
 
  If Yes then
12
 
    begin
13
 
    Writeln ('Bailing out early.');
14
 
    exit;
15
 
    end;
16
 
  Writeln ('Continuing to the end.');
17
 
end;
18
 
 
19
 
Function Positive (Which : Integer) : Boolean;
20
 
 
21
 
{ This function demonstrates the extra FPC feature of Exit :
22
 
  You can specify a return value for the function }
23
 
 
24
 
begin
25
 
  if Which>0 then
26
 
    exit (True)
27
 
  else
28
 
    exit (False);
29
 
end;
30
 
 
31
 
begin
32
 
  { This call will go to the end }
33
 
  DoAnExit (False);
34
 
  { This call will bail out early }
35
 
  DoAnExit (True);
36
 
  if Positive (-1) then
37
 
    Writeln ('The compiler is nuts, -1 is not positive.')
38
 
  else
39
 
    Writeln ('The compiler is not so bad, -1 seems to be negative.');
40
 
end.