Is it possible to exit from a subroutine without reaching the end?
SRT>Subroutine
....
If>Decion1=True,Exit Decision2=True,Continue
Goto>End Continue
....
End>Subroutine
Thanks for your enlightenment.
Subroutine Exit
Moderators: JRL, Dorian (MJT support)
Hi,
That would work but it would cause script execution to continue from the new label and it won't get back to the end of the subroutine and hence the code after the subroutine call.
What you need to do is:
SRT>SubA
If>Decision1=true,ExitSubA
Label>ExitSubA
End>SubA
By setting up an exit label at the end of each subroutine you have a way to jump to the end of it allowing script execution to continue properly - i.e. the end of the subroutine is reached and the statement after the calling statement is processed as normal.
That would work but it would cause script execution to continue from the new label and it won't get back to the end of the subroutine and hence the code after the subroutine call.
What you need to do is:
SRT>SubA
If>Decision1=true,ExitSubA
Label>ExitSubA
End>SubA
By setting up an exit label at the end of each subroutine you have a way to jump to the end of it allowing script execution to continue properly - i.e. the end of the subroutine is reached and the statement after the calling statement is processed as normal.
MJT Net Support
[email protected]
[email protected]