The Return command is used to branch back to the page or script that executed the previous Call or Link command, respectively. The Return command always attempts to return from the previous Call command first, within the same script. But, if the page call stack is empty, Lightwing then attempts to return to the previous script that executed the last Link command, instead. If the script link stack is also empty, Lightwing will report a warning message and continue execution in the current script. The Return command has no parameters since the internal stacks supply the required page and script names. No condition options are allowed on Return commands.
The following example shows a loop which also makes a subroutine call. Subroutines may contain any number of pages, but the last page of each subroutine must have a Return command which continues script execution where it was interrupted. Only one branch command can be used per page.
Example of a Loop with a Subroutine Call and Return page: FirstPage page: SecondPage call: SubroutinePage // Continue here after return. page: ThirdPage jump: FirstPage // Subroutine page: SubroutinePage return: