I Tech Group

Friday, April 8, 2011

DIFFERENCE BETWEEN DO UNTIL & DO WHILE

Do...Loop enables the script to continue to perform certain actions until a specific condition occurs. Do While...Loop enables your script to continue to perform these actions as long as the specified condition remains true. Once the specified condition is no longer true, Do While...Loop exits. In contrast, Do Until...Loop has the opposite effect the script continues to perform the action until a certain condition is met.

Here are common uses of Do Until:
  • Read text from a file
  • Read through records in a record set
  • Create a looping condition for monitoring purposes

The do-while loop is similar to the while loop, except that the test condition occurs at the end of the loop.  Having the test condition at the end, guarantees that the body of the loop always executes at least one time.
The do-while loop is an exit-condition loop.  This means that the body of the loop is always executed first.  Then, the test condition is evaluated.  If the test condition is true, the program executes the body of the loop again.  If the test condition is false, the loop terminates and program execution continues with the statement following the while.

http://mathbits.com/mathbits/compsci/looping/dowhile.htm
http://vbscript.org.ua/0735622973/ch02lev1sec5.html 

No comments:

Post a Comment