RETURN command?


Closed Thread
Results 1 to 22 of 22

Thread: RETURN command?

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: RETURN command?

    Hi, Mike

    I do not think I'ts a cultural practise, but an old time heritage ...

    Have a look to the very first HP programmable calculators programming examples ( HP27C i.e. )
    : the memory was very small and you had to spare as much space as you could to get a decent running program ...
    If you deal with aerospace things, try to get infos about the processor used aboard the famous Grumman F14 ( called 944 ??? https://www.framboise314.fr/le-premi...u-f-14-tomcat/ ) ...


    You are one of the " arduino generation " with plenty of wasted program space !!!
    nowadays, we find processors with Huge memory and people do not care about wasting hundreds of addresses.

    Now, in the end, I kind of feel you are confusing Basic subs and C functions ...

    Try to think BASIC or C ... but do not mix them together !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    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 11:38.

  3. #3
    Join Date
    Feb 2013
    Posts
    1,155


    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.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    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

  5. #5
    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