I have the following code:
foreach(// Some condition here)
{
while (// Some condition here)
{
foreach (// Some condition here)
{
if (// Condition again)
{
//Do some code
}
if (// Condition again)
{
//Stop the first foreach then go back to first foreach
}
}
}
}
What I want to do is when I hit the 2nd if statement on the last foreach loop is to return on the first foreach loop.
Note: If the 2nd if statement is not true, it should continue the last foreach loop until the condition is not true.
Thanks in advance!
break;help?breakwill only exit the current loop, in this case the innermostforeach. OP wants to exit both inner loops, that is the innermostforeachandwhile.