Re: jumping out of subroutine with goto

Originally Posted by
helloo
Hey @ all,
I wonder what happens within the µC when I write code that jumps out of a subroutine with the goto command?
Example:
Code:
main:
GOSUB label
goto main
label:
GOTO somwhereelse
RETURN
somwhereelse:
DOSOMETHING HERE
GOTO main
I know from other BASIC dialects that one should'nt do this, because it messes up the pointers. But what happens in PBP eg. the PIC itself?
Is there a better solution for this problem?
Greetings, helloo
Or, you can try this,
Code:
main:
GOSUB label
goto main
label:
GOSUB somwhereelse
RETURN
somwhereelse:
DOSOMETHING HERE
RETURN
Use GOSUB and RETURN instead of GOTO.
Robert
"No one is completely worthless. They can always serve as a bad example."
Anonymous
Bookmarks