Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:59 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Why is RETURN listed as a "Obselete Commands And Function"?

Author Message
chris
Regular Member

Joined: 24/08/2020
Location: United Kingdom
Posts: 56
Posted: 11:59pm 18 Sep 2020
Copy link to clipboard 
Print this post

I'd like to ask why is RETURN listed in the "Obsolete Commands And Functions" page of the user manual?

Am I out of date somehow to think there is nothing wrong with using RETURN to stop onward progress in a subroutine?
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 12:25am 19 Sep 2020
Copy link to clipboard 
Print this post

MMBasic does subroutines differently.  Subroutines are treated as regular mmbasic commands, so you define the subroutine with "SUB Nameofsubroutine" then your subroutine code and end the definition with "END SUB"
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 719
Posted: 12:26am 19 Sep 2020
Copy link to clipboard 
Print this post

Because ( notice ) GOSUB is also passe'
FUNCTION is more de rigueur  
my site
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 12:28am 19 Sep 2020
Copy link to clipboard 
Print this post

sub music
play wav "oz4.wav" ,music
end sub


plays a wav file over and over again.  you call the subroutine with

music


that's it.  so no need for a return, it returns when the end sub is executed.  This subroutine sets itself as the interrupt handler, so when the wav ends it sends an interrupt which jumps back to itself.
Edited 2020-09-19 10:29 by berighteous
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 12:43am 19 Sep 2020
Copy link to clipboard 
Print this post

EXIT SUB
EXIT FUNCTION

will get you out early if needed.
(And bedevil you if you are not paying attention, particularly with functions.)
Visit Vegipete's *Mite Library for cool programs.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025