DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B1011: exit statement outside its loop

Catalog status: active. Default severity: error. Stable name: misplaced-exit. Family: Names and declarations.

exit leaves the innermost enclosing loop, or the named enclosing loop for exit Name;. It is an error outside any loop, or when no enclosing loop has that name.

Example (Vada)

   Outer : loop
      exit Inner;     --  no enclosing loop is named Inner
   end loop Outer;

Example (Varc)

    outer: loop {
        break inner;    // no enclosing loop is named inner
    }

What to do

Name an enclosing loop, or use return to leave a subprogram.

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See names and declarations, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.