Oxygen Basic
Programming => Problems & Solutions => Topic started by: Brian Alvarez on January 02, 2019, 11:22:38 PM
-
Hello, Is there a way to do something like this?:
GOSUB @ThisLabel
RETURN 0
Thislabel:
' do so some stuff....
RETURN
It currently compiles but return just exits the function instead of returning to the GOSUB call. Same goes for regular GOSUB calls:
GOSUB ThisLabel
' Never gets here.
RETURN 0
Thislabel:
' do so some stuff....
RETURN
This is how it is documented, but i was wondering whats the difference between GOTO and GOSUB? is there a way to return to the calling statement instead of exiting the module?
(Im trying to avoid doing my own stack of calls as im doing now)
-
This is how i am doing it right now. Image attached.
-
Hi Brian,
o2 gosubs are bare-metal Asm calls to a label, and should be terminated by ret instead of return.
-
Thanks charles, i didnt know that. This is much cleaner.