c # in the jump statement

1.goto 语句

goto statement can jump directly to another line program using the specified tag (tag is an identifier, followed by a colon)

goto Lable1;

WriteLine ( "line of code will not execute");

...

Lable1:

The WriteLine ( "jump to the line of code");

limit:

1. The loop can not jump to the image for this block of code can not jump out of the scope of the class.

2. Do not try ... catch block finally exit the back of the block.

Note: The reputation of the goto statement is not very good, generally not allowed to use it, because it is not a good way to object-oriented programming.

2.break statement

Used to exit for, foreach, while, do ... while loop and switch in a case statement.

3.continue statement

continue statement is similar to the break statement, it must be used for, foreach, while, do ... while loop, but it only exit the loop current iteration, at the beginning of the implementation time through the loop, rather than exit the loop.

4.return statement

return statement is used to exit the class method, the control method returns to the caller.

Guess you like

Origin www.cnblogs.com/1016391912pm/p/11352264.html