TeleFlow BasicScript Gosub

TeleFlow BasicScript Gosub

From TeleFlow

Jump to: navigation, search

The GOSUB keyword is used to create subroutines. The RETURN keyword is used to return from the subroutine to the command following the GOSUB that called the subroutine.

Syntax

GOSUB subroutine
BasicScript statement(s)
subroutine:
RETURN


subroutine: name chosen for the subroutine.
Note that within the subroutine code, variables are referred to and affected as global variables. Exclusively global variables are available in this version of BasicScript.


Related Steps

Image:Iv_517.gif BasicScript

Examples

BasicScript code

 

Result

PRINT "start"

GOSUB doitonce

GOSUB doitonce

 

doitonce:

PRINT "Hello"

RETURN

 

start

Hello

Hello

 

 

PRINT "end"

GOTO final

 

doitonce:

PRINT "Hello"

RETURN

 

final:

end