Break and Continue Statement in Linux

Break Statement

The Break statement in used  to terminate the execution of the entire loop, after completing the execution of all of the line of code up to the Break statement. It them steps down to the code following the end of the loop.
The Break command can also be used to exit from a nested loop using this format: break n

Continue statement

The continue statement is slimier to the Break command, except that it causes the current iteration of the loop to exit, rather then the entire loop. This statement is useful when an error has accursed but you want to try to execute the next iteration of the loop.
Like with the break statement. The Continue can also be used to continue from a nested loop using this format: continue n

Leave a Reply