34,333
edits
Changes
→Breaking a Loop
== Breaking a Loop ==
Occasionally it is necessary to exit from a loop before it has met whatever completion criteria were specified are met. To achieve this , the ''break'' statement must be used. The following example contains a loop that uses the ''break'' statement to exit from the loop when i = 100 , even though the loop is designed to iterate 1000 times:
<pre>