unity break 2 loops code example
Example: unity break 2 loops
using System;
class Example
{
static void Main()
{
for (int i = 1; i <= 7; i++)
{
for (int j = 1; j <= 7; j++)
{
int product = i * j;
if (product >= 20)
{
goto LoopEnd; //Stops all the loops to go to "LoopEnd:" on 23th line
}
Console.Write("{0}\t", product);
}
Console.Write("\n");
}
LoopEnd:
Console.WriteLine("\nFinished with calculations.");
}
}