RETURN command?


Closed Thread
Results 1 to 22 of 22

Thread: RETURN command?

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: RETURN command?

    I do not see any safety problem with multiple entries in a sub.

    It is up to the programmer to write correct code and debug it. Say you want 5*6 and accidentally write 5**6. This is valid in PBP but whose fault is now. Compiler's?

    Also valid is the conditional exit from a sub with many returns that depend on the conditions. Not efficient programming but for the sake of example:

    Code:
    mysub:
        if x=3 then
            y=4
            RETURN
        elseif x=5 then
            y=6
            RETURN
        endif
    y=10
    return
    Ioannis
    Last edited by Ioannis; - 12th March 2022 at 10:38.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: RETURN command?

    The main issue that SUB routines are just plain labels, there is no separate category like where you define that this code is SUBroutine, so for sure,there will be no conditional checks for matching number of gosub-returns.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: RETURN command?

    Why this should be checked? I really do NOT want them to be checked so that I can conditionally choose where and when to exit the sub!

    Ioannis

  4. #4
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: RETURN command?

    Hi Guys !

    As I said previously, OK, everybody writes his own code as he likes.

    It is not a matter of memory or old processors or any specific language.

    It is a matter of writing a clean, easily understandable, easily readable code, which can be maintained by you of somebody else years after without too much pain.

    End of the discussion for me. I have many projects to develop.

    MikeBZH.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts