- Introduction
- Control Structures
- If/Then Selection Structure
- If/Then/Else Selection Structure
- While Repetition Structure
- DoWhile/Loop Repetition Structure
- DoUntil/Loop Repetition Structure
- Do/LoopWhile Repetition Structure
- Do/LoopUntil Repetition Structure
- Assignment Operators
- For/Next Repetition Structure
- Example: Using the For/Next Structure to Compute Compound Interest
- SelectCase Multiple-Selection Structure
- Using the Exit Keyword in a Repetition Structure
- Logical Operators
- Introduction to Windows Application Programming
- Summary
3.8 Do/LoopWhile Repetition Structure
The Do/Loop While repetition structure is similar to the While and DoWhile/Loop structures. In the While and DoWhile/Loop structures, the loop-continuation condition is tested at the beginning of the loop, before the body of the loop always is performed. The Do/LoopWhile structure tests the loop-continuation condition after the body of the loop is performed. Therefore, in a Do/LoopWhile structure, the body of the loop is always executed at least once. When a Do/Loop While structure terminates, execution continues with the statement after the Loop While clause. As an example of a Do/Loop While repetition structure, once again consider the segment designed to find the first power of two larger than 1000:
Dim product As Integer = 1 Do product = product * 2 Loop While produce <= 1000