Java - Break statement: break
Used for the immediate interruption of the loop. after execution, will proceed with the following command after loop.break
Description
break ;
Note: Usable in the following locations:
loop with condition at the end loop with condition on the beginning
loop with condition at the end loop with condition on the beginning
Examples
Java
Even one example in what situations we can use the operation break statement:i=10;
do --i; while ( i > 0);
do {
i++;
if (i==5)
break;
} while ( i <10);
Java
Other pieces of example codes:if (i==10) break; else { i--; }
Break statement in another programming language:
Differences to: