QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The GOTO statement sends the procedure to a line label or a line number in the program.

Syntax

GOTO {lineNumber lineLabel}

IF Syntax:

IF condition GOTO {lineNumber lineLabel}
IF condition THEN GOTO {lineNumber lineLabel}

IF condition THEN lineNumber ‘ GOTO may be omitted when line numbers are used

Description

Example(s)


1 PRINT "first line": GOTO gohere
2 PRINT "second line": GOTO 3

gohere:
PRINT "third line"
GOTO 2

3 END 


first line
third line
second line

Explanation: After it prints “first line” it goes to the line label “gohere” where it prints “third line”, then it goes to the line that is numbered “2” and prints “second line” and goes to line number 3 and an END statement which ends the program.

See Also