Break & Continue
Break
Break Statement is used to Exit From the Loop immediately after encounter.
For Example :
You Created a Loop for sum of 100 natural numbers, but you want to exit the loop when the sum reaches to 100, then you have to use Break
Continue
The continue statement is used to skip the current iteration of the loop.
For Example :
You Created a Loop for sum of 100 natural numbers, but you dont want to add 50 to the loop, then you have to use continue
Syntax
Break :
Example :
We will be doing example that we have discussed about i.e.
sum of 100 natural numbers until the sum reaches 1000
Explanation :
Syntax
Continue :
Example :
We will be doing example that we have discussed about i.e.
sum of 100 natural numbers until the sum reaches 1000
Explanation :