Exiting Multiple Loops

I have code that is similar to below. I am wanting to exit from the B loop to the top of the A loop skipping all the other code below the B loop. Is it possible to exit from B somehow to the top of A?

for a as integer = 0 to RowCount
  If this = that Then
    Blah
  Else
    Blah
  End If
  for b as integer = 0 to RowCount
   BLAH
    Else
      //EXIT TO A HERE
      Exit 
    End If
  next b
//Several If statements after testing different things
If BLAH Then
  Blah
End If
next a

Have a look at [Exit — Xojo documentation] (Exit — Xojo documentation) in particular Exit For loopVariable

I looked through that but both Exit and Continue only leave B and continue to the next if below B. Is there a way to specify which loop to continue to?

Something like:
continue for a

Exit For b should continue at the If statement.

1 Like

What you are saying makes no sense…

Exiting Multiple Loops??? Or exit JUST one (b) and skip code in the other (a)??

If the later, just skip the code in a:

//Several If statements after testing different things
If bCompleteLoop = True Then
  If BLAH Then
    Blah
  End If
End If

I think you’re looking for Continue For a
https://docs.xojo.com/Continue

Which you use (Continue For A or Exit For B) depends on whether you want any statements after the For B loop to run. The Continue statement will stop and send you back to the top immediately whereas the Exit statement just drops you out of the loop and continues with the code after the inner loop.