Goto Statement : Goto « Language Basics « VB.Net

Goto Statement

Goto Statement
Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())
       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.Goto a LabelGoto a Label
2.Use GOTO to deal with user inputUse GOTO to deal with user input
3.On Error go to lineOn Error go to line