Download SCREEN CREATOR 5 K-Basic Program Description

Transcript
GOSUB
ADDCYC2
GOSUB
Statement
■ Function
The GOSUB statement executes the specified subroutine.
■ Format
GOSUB subroutine-name
■ Example of Use
GOSUB SUB001
■ Description
• Control is transferred to the subroutine specified after the GOSUB
statement.
• Subroutine names written in the global screen and those in the
program containing the GOSUB statement can be specified. Use the
RETURN statement to return control.
• If the same name exists both in the global and local subroutines, the
global subroutine is called.
■ Related Item
RETURN
■ Example of Program
evnt
X = 10
GOSUB SUB001
numdsp ..NUM000, X
end evnt
SUB001:
ab = X+3
RETURN
4-112
CHAPTER 4 INSTRUCTION REFERENCE