Goto a Label : Goto « Language Basics « VB.Net






Goto a Label

Goto a Label
Imports System

public class MainClass
    Shared Sub Main()
       Dim counterVariable As Integer = 0

 repeat:  ' the label
       Console.WriteLine("counterVariable: {0}", counterVariable)

       ' increment the counter
       counterVariable += 1

       If counterVariable < 10 Then
          GoTo repeat ' the dastardly deed
       End If
    End Sub

End Class



           
       








Related examples in the same category

1.Use GOTO to deal with user inputUse GOTO to deal with user input
2.On Error go to lineOn Error go to line
3.Goto StatementGoto Statement