Tandy 1000 Basic Reference Manual page 175

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
10 I
BASIC Keywords
GOTO
Statement
GOTO
line
Branches to the specified line.
When used alone, GOTO results in a n unconditional branch.
However, test statements, such as IFITHEN, may precede the
GOTO to effect a conditional branch. Note that the GOTO is op-
tional in IFiTHEN statements. For example:
I F X = O THEN 3 6 0 E L S E 2 0 0
BASIC branches t o Line 360 if
X
equals 0. If not, BASIC
branches to Line 200
You can use GOTO in the command mode as an alternative to
RUN. This lets you
pass
values assigned as a command
t o
vari-
ables used in the program.
Example
GOTO 1 0 0
BASIC transfers control t o Line 100.
Sample Program
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
Line 10
READ R
I F R
=
1 3 THEN 8 0
PR
I
N T "R
= "
;
R
A = 3 . 1 4 * R A 2
P R I N T "AREA
= " ; A
GOTO 1 0
D A T A 5 , 7 , 1 2 ,
1 3
END
reads each of the data items in Line 70; Line 60 returns
program control
to
Line
10.
This enables
BASIC to
calculate the
area for each of the data items until it reaches item 13.
173

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents