I remember my Atari behaving awfully slow (whole atari basic environment, even after the program finished) because I did many GOSUBs without the amount of RETURNs necessary, and didn't understand why because I was only 9yo at that time...
Trivia: at least in some BASICs (QBasic, QuickBasic, FreeBASIC) it's not necessary for every GOSUB to be matched with a RETURN, since the GOSUB is a single 'call' instruction that pushes onto the stack (and RETURN is a single 'ret' instruction, hence GOSUB-RETURN is highly efficient!) so it gets removed when you exit the function if you didn't RETURN, like alloca(). I actually re-implemented GOSUB this way using macros and inline assembly. I called it GOSUB/RETRACE.
In Wang BASIC, there was the "RETURN CLEAR" statement which cleared the stack up to and including the most recent GOSUB call frame. This includes any FOR loop frames that were push on the stack in the subroutine before the GOSUB. This was intended to be used for handling error conditions.
Thanks for this! I didn't really use BASIC much back in the day, but I am from - ahem - an older time...and the name seemed so familiar, but quite couldn't place my finger on it. so, thanks for clarifying this! :-)