Howdy, Stranger!

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

Categories

GoTo

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

Comments

  • hobbyhobby Member Posts: 84
    : 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 Member Posts: 3,948
    : : 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]
  • Justin BibJustin Bib USAMember Posts: 0

    _______ \ http://forcoder.org \ free video tutorials and ebooks about || C++ Visual Basic C# R Java Scratch Python Swift Delphi Perl PL/SQL C Objective-C JavaScript Assembly Visual Basic .NET PHP Go MATLAB Ruby COBOL Apex Alice Lua Erlang F# Crystal Fortran Logo Lisp Hack Kotlin D Prolog LabVIEW ABAP Ada Awk Transact-SQL Scala Julia Dart Bash Scheme VBScript ML SAS Rust FoxPro Clojure || _____________

Sign In or Register to comment.