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
| w___w_w._ja__v_a_2s___.__com | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |