Page 1 of 1

END from within GOSUB

Posted: Sat Apr 08, 2023 5:59 pm
by ahenry3068
Is it safe to END a program after a GOSUB without a RETURN. It occurred to me since BASIC is the "OS" this could cause problems with subsequent programs. ?

Most of my BASIC experience is compiled basic on x86 and this was never a problem there.

Re: END from within GOSUB

Posted: Sat Apr 08, 2023 10:31 pm
by TomXP411
Yes, END within a GOSUB is fine. The RUN command does an implied NEW, which resets variables, the FOR loop registers, and the stack.

Re: END from within GOSUB

Posted: Sat Apr 08, 2023 10:49 pm
by ahenry3068
I'm happy for the answer. Thank You. I suspected is was OK but I've had some weird memory management errors come up
when programming in C & Pascal on 16 bit MS-DOS and Windows in the past....

Again, thanks for the answer.

Re: END from within GOSUB

Posted: Sat Apr 08, 2023 10:53 pm
by ahenry3068
I want a universal quit Key for a Craps game I'm working on. Easier to do a GOSUB after input no matter
where you are in the game. Then I just need to RETURN if the user doesn't want to quit.