Break

suggest change

The break statement ends a loop (like for, while) or the evaluation of a switch statement.

Loop:

while(true) {
   if (value == 5) {
       break;
   }
}

The loop runs until value is 5. value is an int in the surrounding code; a boolean cannot be compared with 5.

break ends only the innermost loop or switch. It does not end an enclosing loop. A labeled break does.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents