GoSub

<< Click to Display Table of Contents >>

Navigation:  Control Commands >

GoSub

Description

Subroutine call. When you use the GoSub command, execution is transferred to the specified label and continues until a Return/End Sub command is encountered, at which point execution returns to the command that follows GoSub.

Syntax

GoSub label

or

GoSub Subroutine name

 

where label is defined by the Label identifier and Subroutine name defined by a Sub procedure.
In case of a Sub procedure, the GoSub statement is optional. A Sub procedure can be called directly by is procedure name.

 

GosubDemo  ' or.Gosub GosubDemo

 

 

Sub GosubDemo()

 

End Sub   ' following the GoSub statement.