RETURN |
! from traditional subroutine |
RETURN (<expression>) |
! from SBX, setting return function value |
In the first case—when used without any arguments—RETURN transfers control back to the statement following the last GOSUB, i.e. returns from a traditional BASIC subroutine.
The second case—when followed by an expression—can be optionally used prior to the end of an SBX routine to push a value on to the expression stack, allowing the SBX routine to be called as a function using XFUNC (which see, along with Call SBX as a Function, for details). Note that if the SBX routine is called by the XCALL or VXCALL statements, the RETURN <expression> statement will be treated as the equivalent of END, which returns to the caller without any value pushed on the expression stack.