Give the difference between break and continuous statement?
Answers
Answered by
3
Answer:
Differences between break and continuos statement;
BREAK STATEMENT;
- Break statement mainly used to terminate the enclosing loop such as while, do-while, for or switch statement wherever break is declared.
- Break statement resumes the control of the program to the end of loop and made executional flow outside that loop.
- As mentioned break is used for the termination of enclosing loop.
- Break statement can be used and compatible with 'switch', 'label'.
CONTINUOUS STATEMENT;
- Continue statement mainly skip the rest of loop wherever continue is declared and execute the next iteration.
- Continue statement resumes the control of the program to the next iteration of that loop enclosing 'continue' and made executional flow inside the loop again.
- On other hand continue causes early execution of the next iteration of the enclosing loop.
- We can't use continue statement with 'switch','lablel' as it is not compatible with them.
Explanation:
Similar questions