What is the function of break statement in a while or for loop ?
Question :
What is the function of break statement in a while or for loop ?
If the break statement is included in the while, or for, loop then control will immediately be transferred out of the loop when the break statement is encountered. This provides a convenient way to terminate the loop if an error or other irregular condition is detected.