+ 1
What’s the difference between break and continue?
2 Respuestas
+ 12
The main difference between break and continue is that break is used for immediate termination of loop whereas, continue terminate current iteration and resumes the control to the next iteration of the loop.
+ 4
The break statement brings the control out of the body of loop and stops the further execution of loop.
While continue statement skips the particular iteration after which we have used continue and it does not stop the iteration .The loop goes on skipping just one iteration
We even use break on switch case so that when a particular case is matched it brings the control out of the body of switch and avoids checking for other cases coz we have already figured out the answer.