Google News
logo
C# - Interview Questions
What is break and continue statements in C#, explain?
Break Continue
You can use break statements in both switch and loop (for, while, and do-while ) statements. You can use continue statements only in the loop (for, while, do) statements.
The switch or loop statements terminate at the moment the break statement is executed and it ends abruptly from there. You cannot make a continue statement terminate the loop, it carries on the loop to go to the next iteration level without executing the immediate next step.
The loop or switch exits immediately from the inner loop when the compiler encounters a break statement and comes out of the inner loop. A continue that is placed inside a nested loop within a switch causes the next loop iteration.
Advertisement