9.7. Jump Statements

Jump statements break the conventional flow of the control statements we have discussed. The C# jump statements are as follows:

  • break. The break statement terminates the closest enclosing loop or conditional statement in which it appears. Control is passed to the statement that follows the terminated statement, if any. The break statement takes this form:

    break-statement:break;
    
  • continue. The continue statement passes control to the next iteration of the enclosing iteration statement in which it appears.

  • goto. The goto statement transfers program control directly to a labeled statement.

The goto statement takes one of the following forms:

goto identifier;
goto case constant-expression;
goto default;

where

  • identifier is ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.