![]() |
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 KingdomPosts: 56 |
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 StatesPosts: 110 |
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 StatesPosts: 719 |
Because ( notice ) GOSUB is also passe' FUNCTION is more de rigueur ![]() my site |
||||
berighteous Senior Member ![]() Joined: 18/07/2020 Location: United StatesPosts: 110 |
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: CanadaPosts: 1132 |
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. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |