How to break nested foreach loop then go to parent foreach loop on c# -


i have following code:

foreach(// condition here) {     while (// condition here)     {         foreach (// condition here)         {              if (// condition again)              {                   //do code              }              if (// condition again)              {                  //stop first foreach go first foreach              }         }     } } 

what want when hit 2nd if statement on last foreach loop return on first foreach loop.

note: if 2nd if statement not true, should continue last foreach loop until condition not true.

thanks in advance!

the way directly goto.

another (better) option restructure until problem goes away. instance putting inner code (while + foreach) in method , use return back.


Comments

Popular posts from this blog

html - Cut text on left side inside button while centering -

What design pattern is this code in Javascript? -

java - Last square of 8x8 grid not drawn, using two nested FOR loops -