EasyManuals Logo
Home>Atari>Desktop>800

Atari 800 Basic Reference Manual

Atari 800
122 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #27 background imageLoading...
Page #27 background image
The
IF/THEN
statement
is a conditional
branch
statement.
This
type
ofbranch
occurs
only
if
certain
conditions
are
met.
These
conditions
may
be
either
arithmetical
or
logical.
If
the
aexp
following
the
IF
statement
is
true
(non-zero),
the
program
executes
the
THEN
part
of
the
statement.
If,
however,
the
aexp
is
false
(a
logical
0),
the
rest
ofthe
statement
is
ignored
and
program
control
passes
to
the
next
numbered
line.
In
the
format,
IF
aexp
THEN lineno,
lineno
must
be
a cons
tant,
not
an
expression
and
specifies
the
line
number
to go to
if
the
expression
is
true.
If
several
statements
occur
after
the
THEN, se
parated
by
colons,
then
they
will
be
ex-
ecuted
if
and
only
if
the
expression
is
true.
Several IF
statements
may
be
nested
on
the
same
line
.
For
example:
The
statements
R=9
: GOTO 100
will
be
executed
only
if
X=S
and
Y=3
.
The
statement
Y = 3
will
be
executed
if
X=
5.
The
following
program
demonstrates
the
IF/THEN
statement.
5
GRAPHIC~;
0:?
:?
II
IF
DH10
11
10
? =?
"ENTER
Au
j:
HlPUT
A
20
IF
A=
1
THEH
4t1
:
F.:Et-1
t·1i-'ttT
I
PLE
:::TATH1Et·H
~:;
HEF.~E
~·JILL
t£UEF.~
BE
E:=<ECUTED!
!
30
? = ?
II
A
I~:
;
HOT
1 .
E:=<ECUT
I
oN
com r
t·UE
s
HH~E
L·JHH~
THE
D~PPE::s
I
Ot
·i r s
FALSE
.
II
40
IF
A=l
THEt
·i ? ; '?
11
A=1
II:?
"\'ES..
IT'
IS
REALL'l'
1.
II
:
REt-1
t1UL
iiPLE
:~;TATEt1HHS
HEPE
WLL
BE
E>TCUTED
ot·ll\'
IF
A=l
! !
50
·?
:?
HE>~ECUTIOf·~
COt·iT
I
~-iUE~;
HEF.:E
IF
A<
>
1
OF.:
AFTEF:
I 'rE; ·'
IT
I
~3
REALL'r'
1 I
Is
D I
SF'
LA'r'ED.
u
6f1
GOTO
10
Figure
4-7.
IF
/
THEN
Program
Et-HER
A
A
IS
t·WT
1 .
E:;::ECUT
IOH
COt-H
H~UE~3
HEF.~E
~JH
Et·l
THE
E:=O::PRESSIOt-~
IS
FAL~3E.
E>{ECUTIOt-~
COtH
H~UES
HERE
IF
A<>
1
OR
AFTE
R ''lES)
IT
IS
REALL\'
1'
IS
DISPLAYED
.
EtHER
A
A=1
'/ES
)
IT
IS
F.:EALL
\'
1 .
E::<ECUTIOt-~
COtH
H4UE::;
HEF.:E
IF
A<>
1
OR
AFTE
R
"'i'E~:;
..
IT
I::;
F.:EALL'r'
1'
IS
DISPLA'/ED.
ENTEP
A
Figure
4-8.
IF
/
THEN
Program
Execution.
(enter
ed
Z)
(enter
ed
1)
Program
Statements
19

Table of Contents

Other manuals for Atari 800

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari 800 and is the answer not in the manual?

Atari 800 Specifications

General IconGeneral
BrandAtari
Model800
CategoryDesktop
LanguageEnglish

Related product manuals