Jump to content

How to exit from for loop

Recommended Posts


For i = 1 to 5
' do somthing

For j = 1 to 5
' do something
if a = b then 
  exit for
end if


'' continue here

I have two for loops. If a = b how can I exit out from both loops so it will continue from the line says "continue here" ?Currently, it exits out of inner loop only. 



Link to post
Share on other sites

I don't know if that statement takes any other value to tell it how many levels to exit, but if not then can set a variable before you exit that you can check in the outer loop to see whether or not to exit.  That's a little confusing though and suggests that there's a more efficient way to design what you're trying to do.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...