The other answers provided give a good explanation of how to use GOTO and GOSUB, but there is an important difference in how they are processed. When GOTO is executed, it starts at the top of the stack and flips through all the lines of code until it finds the line that it should use GOTO. Then, if you use another GOTO statement to return, it goes to the top of the stack again and flips through everything until it reaches the next place.
GOSUB does almost the same as GOTO, but he remembers where he was. When you use the RETURN operator, it just bounces back without going to the top of the stack and flipping over again, so it is much faster. If you want your code to work fast, you should put your most-called routines at the top of the stack and use GOSUB / RETURN instead of GOTO.
Greyphilosophy
source share