goto statement jumps to another labeled location.
goto statement has the form of
goto label;
When using with switch statement its form is
goto case caseConstant;
using System;
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
if (i == 1)
{
goto end;
}
}
end: Console.WriteLine("The end");
}
}
The output:
The end