Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

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 
  • + Share This
  • 🔖 Save To Your Account