break
The
break
statement terminates a loop or a
switch..case
statement, and continues with the first instruction after the closing bracket.
Example:
while (x < 100) { x+=1; if (x == 50) { break; }
// loop will be ended prematurely
}
See also:
while
,
for
,
switch
,
continue
► latest version online