Do Loop with Exit Do : Exit « Statements « VB.Net Tutorial






Option Strict On
 Imports System
 Module Module1

    Sub Main( )
       Dim counterVariable As Integer = 0

       Do
          Console.WriteLine("counterVariable: {0}", counterVariable)
          counterVariable = counterVariable + 1

          If counterVariable > 9 Then
             Exit Do
          End If
       Loop

    End Sub 'Main

 End Module
counterVariable: 0
counterVariable: 1
counterVariable: 2
counterVariable: 3
counterVariable: 4
counterVariable: 5
counterVariable: 6
counterVariable: 7
counterVariable: 8
counterVariable: 9








4.13.Exit
4.13.1.Using the Exit keyword in repetition structures
4.13.2.Do Loop with Exit Do
4.13.3.Exit For