My apologies, gentlemen, I didn't realise the code hadn't been posted. Here it is:
gosub_test()
input "press return",s$
function gosub_test
print "in function"
gosub test_sub
`return
test_sub:
print "in subroutine"
` return
endfunction
I have a GOSUB...RETURN entirely within the function, but if either RETURN statement is uncommented, then the program simply exits as soon as it starts.
It doesn't matter now, as I was just trying to avoid a huge line of code after an IF...THEN which I've now solved with an ENDIF. I was just wondering why including a RETURN in a function causes a crash.