Jump to content
Sign in to follow this  
joncom

Do.. Until // While ... WEnd

Recommended Posts

Could someone please explain to me what the different is? They are both loops that run until the condition is met.... how do they differ?

Share this post


Link to post
Share on other sites

Could someone please explain to me what the different is? They are both loops that run until the condition is met.... how do they differ?

<{POST_SNAPBACK}>

They don't differ. Are you satisfied?

Share this post


Link to post
Share on other sites

Do...Until always runs the code at least once. It checks the condition after each run through the body of the loop. While...WEnd checks the condition before running the code, so its possible that the code may not execute if the condition isn't true at the start of the loop. Also, the While loop runs while a condition is true and stops when it is false. The Do loop runs while a condition is false and stops when the condition is true.

For example:

While 1 = 2
    MsgBox(4096, "", "This will never print")
WEnd

Do
    MsgBox(4096, "", "This prints")
Until 1 <> 2

And Slim, they are totally different. They must be thought of in different ways and are used in different ways, therefore, they are different. If they weren't different, they both wouldn't be present.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...