Example:
10 PRINT "Reinier"
20 GOTO 40
30 PRINT "QBasic"
40 PRINT "programs"
Output:
Reinier
programs
The program skips from 20 to 40, skipping 30 completely.
Example:
10 PRINT "Reinier is";
20 GOSUB 50
30 PRINT "years old."
40 END
50 A=13
60 PRINT A;
70 RETURN
Output:
Reinier is 13 years old.
Note: The program is for illustration of GOSUB only. The program can be written in a much easier way.
The program does line 10, then in line 20 it jumps to 50. The program executes the lines thereafter until it hits RETURN, and it returns to the line after GOSUB, which is 40. The program ends there, because of END.
Example:
PRINT "Reinier"
GOTO Line
PRINT "QBasic"
Line:
PRINT "program"
Output:
Reinier
program
GOSUB works the same way.