Does anyone know how to break out of a double loop?
I understand that by using "break;" you can jump out of a loop. But what happens when i'm running through a 2-d array and i want to break out of a double loop? Is there any simple way like "break, break;" or "break 2x" LOL?
I could assign a boolean variable "true" then test whether it is true in the outer loop.
example:
for (y= 0; y < 10;y++)
{
for (x = 0; x < 10; x++)
{
if (arrayTwoDimension[x][y].getState = true)
{
blnBreak = true;
break;
}
}
if (blnBreak = true) // tedious
break;
}
Note the test in the 'y loop' (blnBreak = true).
Anyone know a quick fix for this problem? What should I be doing in this situation?