Professional Documents
Culture Documents
Generally, program executes sequentially; the statements execute one line after another, in
sequential order. GOTO lets program jump to a different location. GOTO lets a user to execute
the same line (or lines) repeatedly.
Syntax
Statement label is a line number or a line label. Separate line-number labels from the rest
of the line with at least one space. In case of a word label, separate it from the rest of the line
with a colon. Name non-numeric labels according to the naming rules of variables.
Examples
Example 1: Use of GOTO with line labels Example 2: Use of GOTO with line-numbers
CLS CLS
GOTO Here GOTO 300
First:
PRINT “A” 100 PRINT “A”
GOTO Final GOTO 400
There:
PRINT “B” 200 PRINT “B”
GOTO First GOTO 100
Here:
PRINT “C” 300 PRINT “C”
GOTO There GOTO 200
Final:
END 400 END