VB.Net/Language Basics/Exit
Версия от 16:40, 26 мая 2010; (обсуждение)
Exit a Do While Loop
Imports System
Public Class MainClass
Shared Sub Main()
"Declare variable
Dim intCount As Integer = 0
"Process the loop
Do While intCount < 10
"Add the item to the list
System.Console.WriteLine(intCount)
"Increment intCount by 1
intCount += 1
"Should you quit
If intCount = 3 Then
Exit Do
End If
Loop
End Sub
End Class
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
Exit an Application
Public Class MainClass
Shared Sub Main()
System.Environment.Exit(System.Environment.ExitCode)
End Sub " ValidationError
End Class