Mega Code Archive

 
Categories / VB.Net / Language Basics
 

Exit a Loop

Imports System Public Class MainClass     Shared Sub Main(ByVal args As String())        Dim counterVariable As Integer = 0        Do           Console.WriteLine("counterVariable: {0}", counterVariable)           counterVariable = counterVariable + 1           ' test whether we've counted to 9, if so, exit the loop           If counterVariable > 9 Then              Exit Do           End If        Loop     End Sub End Class