return( )

Description

After a call(), use this to return to where you called from.

The return point is the line following the call.

Example / explanation

Consider this example (with line numbers marked on the left for clarity):
--  [...file opened...]
23  set F to 101
24  call("outputpage")
25  
26  set F to 102
27  call("outputpage")
28
--  [...file closed...]
35  terminate()
36
37  .outputpage
38    selectframe(F)
39    set B to status(frames)
40    if (B = 0) appendframe(F)
41    if (B ! 0) appendframes(F)
42
43    return()

The first call is line 24, which will cause execution to jump to line 38 (remember, labels record the line following the definition). The code in the subroutine nominally called 'outputpage' will be run, until we reach return at line 43. At this point, execution will be transferred back to line 25, which is the line following the call.

Notes

Obviously every call() must have a corresponding return(). It is valid to have multiple return points (i.e. off of if() statements), so long as logically you will only be able to take one path at a time.

Calling return() with no call stack is an error condition; so is finishing the script with a call stack in place (suggests a missing return()).

Specifics

Under RISC OS, you may only call() to a maximum of 16 levels deep. The Windows script interpreter has no such limitation.
Note, also, that the RISC OS script interpreter only permits up to 16 labels to be defined, which may prove more restictive.