C# goto statement

The C# goto statement is an unconditional statement that lets the control go to a particular label mentioned in the statement.

In some cases, the goto statement is useful to get out of the deeply nested loops.

C# goto Statement Syntax

goto start;

Where goto is the keyword and start is the label name.

There are two forms of goto statements.

Forward jump

C# goto Statement Syntax 1

Backward jump

C# goto Statement 2

In general, usage of the goto is not recommended in the real-time environment because it becomes difficult to trace the control during the C# program execution.

Categories C#