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

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

Текущая версия на 12:42, 26 мая 2010

Do Loop While

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

End Class


Do While Loop

Imports System
public class MainClass
    Shared Sub Main()
       Dim counterVariable As Integer = 0
       Do While counterVariable < 10
          Console.WriteLine("counterVariable: {0}", counterVariable)
          counterVariable = counterVariable + 1
       Loop 
    End Sub
End Class


If inside Do While loop

Imports System
public class MainClass
    Shared 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
End Class