100 REM Purpose: Verify RETURN exits a FUNCTION
110 REM  Author: Howard Wulf, AF5NE
120 REM    Date: 2015-12-23
130 REM

200 DEF TEST( X )
210     GOSUB 400
220     LET TEST = X * 7
230     RETURN
240     PRINT "TEST FAILED - RETURN NOT EXECUTED"
250     STOP
260 FEND

300 PRINT "ABOUT TO EXECUTE TEST"
310 LET N = TEST( 2 )
320 IF N = 14 THEN 500
330 PRINT "TEST FAILED - WRONG RESULT"
340 GOTO 999

400 REM SUBROUTINE CALLED FROM WITHIN DEF...FEND
410 PRINT "EXECUTED SUBROUTINE"
420 RETURN

500 PRINT "TEST PASSED"

999 END
