-
Book Overview & Buying
-
Table Of Contents
Visual Basic Quickstart Guide
By :
A post-condition loop is a control flow structure in computer programming that repeatedly executes a code block until a specific condition is met after completing the loop body. In contrast to a pre-condition loop, a post-condition loop executes the loop body first and then evaluates the condition to determine whether it should continue iterating. Because of the first iteration, a post-condition loop will always run one or more times.
In VB, a Do loop is a control structure that implements a post-condition loop. The basic syntax for a Do loop in VB is as follows:
Do 'code to run Loop While test_condition
In this example, the loop will run the code block if test_condition is true. After executing the loop body, the Do loop evaluates test_condition at the end of each iteration. If test_condition is false, the loop terminates, and execution continues with the statement following the loop.
Here’s a VB.NET example of a Do loop in VB...