[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.77 Exit

Synopsis

 
procedure Exit;

Description

`Exit' leaves the currently executed procedure or function. Note: If `Exit' is called within the main program, it will be terminated instantly.

Conforming to

`Exit' is a UCSD Pascal extension. GNU Pascal does not support all uses of `Exit' but only those defined in Borland Pascal.

Example

 
program ExitDemo;

procedure Foo (Bar: Integer); var Baz, Fac: Integer; begin if Bar < 1 then Exit; { Exit foo } Fac := 1; for Baz := 1 to Bar do begin Fac := Fac * Baz; if Fac >= Bar then { Exit foo } Exit; WriteLn (Bar,' is greater then ', baz, '!, which is equal to ', Fac) end end;

begin Foo (-1); Foo (789); Exit; { Terminates program } Foo (987654321) { This is not executed any more } end.

See also

section 9.30 Break, section 9.52 Continue, section 9.108 Halt



This document was generated by Frank Heckenbach on May, 10 2002 using texi2html