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 of the following is the correct If clause to determine whether y is in the range 10 through 50 not inclusive?Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive? if y >= 10 and y <= 50: Expressions that are tested by the if statement are called Boolean expressions.
Which logical operators perform shortWhich logical operators perform short-circuit evaluation? Short-circuit evaluation is performed with the not operator.
Does the If statement causes one or more statements to execute only when a Boolean expression is true?The if statement causes one or more statements to execute only when a Boolean expression is true. The if statement is used to create a decision structure, which allows a program to have more than one path of execution.
Which structure determines the order in which a set of statements executes?A control structure is a logical design that controls the order in which a set of statements execute.
|