VB.Net Program to Demonstrate the Use of the Goto Statement

You are currently viewing VB.Net Program to Demonstrate the Use of the Goto Statement

VB.Net program to demonstrate the use of the GoTo statement

'VB.Net program to demonstrate the 
'use of the "GoTo" statement.

Module Module1
    Sub Main()
        Dim num As Integer = 0
MyLabel:
        num = num + 1

        If num <= 10 Then
            Console.Write("{0} ", num)
            GoTo MyLabel
        End If

        Console.WriteLine()
    End Sub
End Module

Output

1 2 3 4 5 6 7 8 9 10
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply