VB.Net/Language Basics/Do Until — различия между версиями

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

Версия 16:40, 26 мая 2010

Do Until Loop

Imports System
Public Class MainClass
    Shared Sub Main(ByVal args As String())
       Dim counterVariable As Integer = 0
       Do Until counterVariable = 10
          Console.WriteLine("counterVariable: {0}", counterVariable)
          counterVariable = counterVariable + 1
       Loop " Until counterVariable = 10
    End Sub

End Class


Exit from Do Until

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

      Do Until counter > 10
         " skip remaining code in loop only if counter = 5
         If counter = 5 Then
            Exit Do
         End If
         counter += 1
      Loop
      Console.WriteLine("counter = " & counter & _
         " after exiting Do Until/Loop structure" & vbCrLf)
    End Sub
End Class