Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Do...Loop Statement (Visual Basic)
In this articleRepeats a
block of statements while a Syntax
Parts
RemarksUse a You can use either You can test The condition usually results from a comparison of two values, but it can be any expression that evaluates to a Boolean Data Type value ( You can nest Note The Exit DoThe
Exit Do statement can provide an alternative way to exit a
You can include any number of When used within nested Example 1In the following example, the statements in the loop continue to run until the
Example 2The following example uses a
Example 3In the following example,
Example 4The following example reads all lines in a text file. The OpenText method opens the file and returns a
StreamReader that reads the characters. In the
See also
FeedbackSubmit and view feedback for Which loop repeats a set of statements until the given condition is true?The repeat / until loop is a loop that executes a block of statements repeatedly, until a given condition evaluates to true . The condition will be re-evaluated at the end of each iteration of the loop, allowing code inside the loop to affect the condition in order to terminate it.
Is a type of loop that is used to repeat the statement or group of statements while given condition?A while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement.
Which loop is performed when the condition is true?With a do while loop the condition is not evaluated until the end of the loop. Because of that a do while loop will always execute at least once. A for-loop always makes sure the condition is true before running the program.
What is the condition for a while loop to repeat?A while loop evaluates condition inside the parenthesis () . If condition evaluates to true , the code inside the while loop is executed. condition is evaluated again. This process continues until the condition is false .
|