Sub...Exitsub...EndSub
Program flow management function.
The Sub...EndSub structure defines a subroutine.
Syntax
Sub <sub_name>([<param1>[,<param2>]....])
[local <variable_name>]
<statements>
[ExitSub]
<statements>
EndSubParameters
<sub_name>, name of the subroutine. The maximum length of the name is 32 characters.
<param>, optional parameters. Parameters are passed by reference, not by value.
The keyword LOCAL permits the declaration of local variables.
ExitSub is used to quit the subroutine inside the procedure.
Remarks
The execution of a subroutine is stopped either by an EndSub statement, or by an ExitSub statement. ExitSub can be used anywhere within the subroutine.
See also
Example code
Sub my_routine()
ret=msgbox("Would you like to leave the subroutine?",4,"EXAMPLE")
if ret=6 then
' If ret=yes then leave the subroutine
ExitSub
endif
msgbox("I'm in my subroutine")
EndSub
my_routine()
' execute the subroutine
msgbox("Program end !")