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

## 9.30 Break

### Synopsis

    Break  { simple statement }

### Description

With ``Break'` you can exit the body of the current loop instantly. It can only be used within a while, repeat or a for statement.

### Conforming to

``Break'` is a Borland Pascal extension.

### Example

    program BreakDemo;
    var
      Foo: Integer;
    begin
      while True do
        begin
          repeat
            WriteLn ('Enter a number less than 100:');
            ReadLn (Foo);
            if Foo < 100 then
              Break;             { Exits repeat loop }
            WriteLn (Foo, ' is not exactly less than 100! Try again ...')
          until False;
          if Foo > 50 then
            Break;              { Exits while loop }
          WriteLn ('The number entered was not greater then 50.')
        end
    end.

### See also

section 8.1.7.13 Loop Control Statements, section 9.52 Continue, section 9.77 Exit, section 9.108 Halt, section 9.231 Return, section 9.106 goto.

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