Tandy 1000 Basic Reference Manual page 178

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
10
I
BASIC Ke.ywords
I F X
>
0 AND Y
< >
0 THEN Y
=
X
+
1 8 0
assigns the value X
+
180 to Y if both exm-essions are true.
Otherwise, BASIC executes the next program- line, skipping the
THEN clause.
IF
A $
=
" Y E S "
THEN 2 1 0 E L S E
I F
A $
=
"NO"
THEN
branches to Line 210 if A$ is YES. If not, BASIC skips to the
first ELSE, which introduces a new test. If A$ is NO, then
BASIC branches to Line 400. If A$ is any value besides NO or
YES, BASIC branches to Line 370.
4 0 0 E L S E 3 7 0
Sample Program
IFiTHENiELSE statements may be nested. However, you must
take care t o match up the IFs and ELSEs. (If the statement does
not contain the same number of ELSEs and IFs, each ELSE is
matched with the closest unmatched IF.)
1 0 4 0 I N P U T "ENTER
TWO NUMBERS";
A ,
B
1 0 5 0 I F
A
< =
B
THEN I F A
<
B
THEN P R I N T A ;
E L S E
P R I N T
"
N E I T H E R " ;
E L S E P R I N T
E ;
1 0 6 0 P R I N T
"
I S
SMALLER THAN THE OTHER"
This program prints the relationship between the 2 numbers
entered.
176

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents