GoTo - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

GoTo

Runt1128Runt1128 Posts: 18Member
If i use the GoTo command to jump to a place in my code, how do i return ?

Comments

  • hobbyhobby Posts: 84Member
    : If i use the GoTo command to jump to a place in my code, how do i return ?
    :

    You don't. The GoTo command is a remnant of the old programming style. If you want to jump to another piece of code and return use a function call or a subroutine call. If you want to do a conditional test, use the If...Then or Select...Case.

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : : If i use the GoTo command to jump to a place in my code, how do i return ?
    : :
    :
    : You don't. The GoTo command is a remnant of the old programming style. If you want to jump to another piece of code and return use a function call or a subroutine call. If you want to do a conditional test, use the If...Then or Select...Case.
    :

    It's not recommended to use GoTo or GoSub, but if you must use it then GoSub...Return is what you want:
    [code]
    Sub DoNothing()

    GoSub OverThere '1st
    Exit Sub '3rd

    OverThere:
    Return '2nd

    End Sub
    [/code]
Sign In or Register to comment.