Break and Continue

Published by Mario Oettler on

The break statement is used when we want to terminate a loop. After the break statement, the control is passed to the code after the loop. It works with different types of loops like for, while, and do while.

The continue statement is used if we want to skip the remaining code of a loop and start the next iteration of the loop immediately. It works with for, while, and do while loops.