Skip to content
This repository was archived by the owner on Aug 27, 2021. It is now read-only.
JBtje edited this page Jun 8, 2015 · 2 revisions

Syntax

GOSUB <line number>

RETURN

Description

The GOSUB command can be used to jump to another line in the program and runs until the next RETURN statement. This command can be used to emulate a function and is usefull if some code needs to be used more than once.

If an array is defined (using DIM) in a Subroutine, the array will only exist for the duration of the subroutine.

Example

NEW
10 A = 0
20 GOSUB 100
30 GOSUB 100
40 GOSUB 100
40 GOSUB 100
40 GOSUB 100
50 PRINT A
60 END
100 A = A + 1
110 RETURN
RUN

Above example should print "5"

Clone this wiki locally