filmov
tv
11 What is Break, Continue and Goto Statements in C# net

Показать описание
Break Statement:
is used to break loop or switch statement. It breaks the current flow of the program at the given condition. In case of inner loop, it breaks only inner loop.
syntax:
jump-statement;
break;
Continue Statement:
The C# continue statement is used to continue loop. It continues the current flow of the program and skips the remaining code at specified condition. In case of inner loop, it continues only inner loop.
Syntax:
jump-statement;
continue;
Goto Statement:
goto statement is also known jump statement. It is used to transfer control to the other part of the program. It unconditionally jumps to the specified label.
It can be used to transfer control from deeply nested loop or switch case label.
is used to break loop or switch statement. It breaks the current flow of the program at the given condition. In case of inner loop, it breaks only inner loop.
syntax:
jump-statement;
break;
Continue Statement:
The C# continue statement is used to continue loop. It continues the current flow of the program and skips the remaining code at specified condition. In case of inner loop, it continues only inner loop.
Syntax:
jump-statement;
continue;
Goto Statement:
goto statement is also known jump statement. It is used to transfer control to the other part of the program. It unconditionally jumps to the specified label.
It can be used to transfer control from deeply nested loop or switch case label.