VB.Net/Language Basics/While

Материал из VB Эксперт
Перейти к: навигация, поиск

Exit from While Loop

Imports System
Public Class MainClass
    Shared Sub Main(ByVal args As String())
      Dim counter As Integer

      While counter <= 10
         " skip remaining code in loop only if counter = 7
         If counter = 7 Then
            Exit While
         End If
         counter += 1
      End While
      Console.WriteLine( "counter = " & counter & _
         " after exiting While structure")
    End Sub
End Class