Tuesday, December 10, 2013

Code that uses goto on loop [C#]

static int GotoMethod()
{
    int dummy = 0;
    for (int a = 0; a < 10; a++)
    {
 for (int y = 0; y < 10; y++) // Run until condition.
 {
     for (int x = 0; x < 10; x++) // Run until condition.
     {
  if (x == 5 &&
      y == 5)
  {
      goto Outer;
  }
     }
     dummy++;
 }
    Outer:
 continue;
    }
    return dummy;
}

http://www.dotnetperls.com/goto
Multidimensional Arrays (C# Programming Guide)

No comments:

Post a Comment