O'Reilly logo

Visual C#® 2012: How to Program, Fifth Edition by Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.7. break and continue Statements

In addition to selection and repetition statements, C# provides statements break and continue to alter the flow of control. The preceding section showed how break can be used to terminate a switch statement’s execution. This section discusses how to use break to terminate any repetition statement.

break Statement

The break statement, when executed in a while, for, do...while, switch, or foreach, causes immediate exit from that statement. Execution typically continues with the first statement after the control statement—you’ll see that there are other possibilities as you learn about additional statement types in C#. Common uses of the break statement are to escape early from a repetition statement or to skip ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required