GOTO

GOTO linelabel

Transfers control to the subroutine indicated by the line label.


linelabelThe line label or line number you want to jump to.

REMARKS
* The line label must be inside the current subroutine.
* This statement is provided for backwards compatibility and should not be used.
* Instead of using this statement you should divide your subroutine into smaller components.
* Using this statement will create Spaghetti Code
* For the Microsoft documentation refer to learn.microsoft.com

Public Sub GoTo_Example() 
Dim number As Integer
    number = 2
    If number = 1 Then
        GoTo LineLabel1
    End If

    GoTo LineLabel2

LineLabel1:

LineLabel2:

End Sub

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top