Duration: 20 minutes
Summary: In this video, we will illustrate the use of break and continue statements. These statements come handy when we want to terminate the loop early or skip over a section in a loop. We have seen the for statement before and how we can loop over a block of code for a number of times. Sometimes, we need to terminate the loop early because of a specific condition. That is when we use the break statement. Other times, we might have inner loops. For that we use a break with a label. We add a label to the loop we are interested in breaking out of, and we break using that label. Finally, we might need to skip over a section in the loop and go over to the next iteration because of a specific condition. In that case we use the continue statement. As the name implies, this statement says stop processing the current iteration and move over to the next one.
Methodology of the development of example: .