Do While Loop Statement

Do While Loop Statement is used to execute a set of statements only if the condition is satisfied. But the loop get executed once for a false condition once before exiting the loop. This is also know as Entry Controlled loop.

Syntax:
    Do While [Condition]
       [Statements]
    Loop
In the above syntax the Statements are executed till the Condition remains true.

Example:
    Private Sub Form1_Load(ByVal sender As System.Object,
         ByVal e As System.EventArgs) Handles MyBase.Load
      Dim a As Integer
      a = 1
      Do While a < 100
        a = a * 2
        MsgBox("Product is::" & a)
      Loop
    End Sub

No comments:

Post a Comment