返回到:VB.Net – 循环
GoTo语句无条件地将控制传递到过程中的特定行。
GoTo语句的语法是:
GoTo label
流程图:

示例:
Module loops
Sub Main()
' local variable definition
Dim a As Integer = 10
Line1:
Do
If (a = 15) Then
' skip the iteration '
a = a + 1
GoTo Line1
End If
Console.WriteLine("value of a: {0}", a)
a = a + 1
Loop While (a < 20)
Console.ReadLine()
End Sub
End Module当上述代码被编译和执行时,它产生以下结果:
value of a: 10 value of a: 11 value of a: 12 value of a: 13 value of a: 14 value of a: 16 value of a: 17 value of a: 18 value of a: 19
返回到:VB.Net – 循环
作者:terry,如若转载,请注明出处:https://www.web176.com/vbnet_api/11470.html
支付宝
微信