break
statement
The break
statement is a control directive that causes immediate
termination of the enclosing for
or while
loop.
Usage
The general form of the break
statement is
// ...within a while or for statement
// and often guarded by some condition
break;
Description
Execution
Within a for
or while
statement the break
directive can be used to exit
the block early without waiting for the for
iterator to be exhausted or the
while
condition to become false
.
Notes
- Java's 'labelled'
break
directive is not supported. Thebreak
directive operates on the directly enclosingfor
orwhile
statement.
See also
- The
continue
statement - The
for
statement - The
while
statement - Control directives in the Ceylon language specification