While with goto statement : Goto « Statement « C# / CSharp Tutorial






using System;

class MainClass
{
  static void Main(string[] args)
  {
    int a = 0;

    while (a < 10)
    {
      if (a == 5)
        goto cleanup;
    }
  cleanup :

    Console.WriteLine(a);
  }
}








4.9.Goto
4.9.1.Use goto with a switch
4.9.2.Demonstrate the goto.
4.9.3.While with goto statement
4.9.4.The use of the goto statement in a if statement