Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.