Saved Bookmarks
| 1. |
Differentiate between break and continue statements in C++. |
|
Answer» break statement: It is used to skip over a part of the code i.e. we can premature exit from a loop such as while, do-while, for or switch. Syntax: while (expression) { if (condition) break; } continue statement: It bypasses one iteration of the loop. That is it skips one iteration and continue the loop with next iteration value. Syntax : while (expression) { if (condition) continue; } |
|