EasyManua.ls Logo

Radio Shack TRS-80

Radio Shack TRS-80
236 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
Loading...
EXERCISE
6-3: Change
the value of A in
line
10
at
least
three more times,
running
after
each
change to ensure
that your new program
works
correctly
.
The IF-THEN
statement
is
what
is known as
a CONDITIONAL
branching
statement.
The
program
will "branch" to
another part
of
the
program on the
condition
that
it passes
the
test it contains.
If it fails
the test, the
program simply
continues to
the
next line.
A
statement
called
GOTO
is known as
an
UNCONDITIONAL
branching
statement. If we
were
to
replace
lines
40
and
80
with GOTO
99,
and add line
99:
99
END
.
whenever the
Computer hit
line
40
or
80
it
would
unconditionally
follow orders
and
go to 99,
ENDing
the run.
While your
Radio
Shack
Computer
is rather broad-minded
when it comes to
accepting
these various BASIC
dialects, many
computers are not. For
practice, change
lines
40,
80
and 99
as
discussed above
and
Did the
program
work OK
as changed?
Did you try
it
with several
values of
A?
Be sure
you do so!
We will find
many uses for the
GOTO
statement
in
the future.
Statements
IF-THEN-
Ci-jt-
GOTO
Learned in
Chapter
6
Relational
"ii
Operators
X,
>
<
<
>
<
=
>
=
SfisceHatteous
Conditional
branching
Unconditional
branching
No
sample
answers
are giv?n ^iftce
you
are
fthoosmg
your
own
values
of.A-
It
wiil
be
obvious
Whether
or
dot
you
are getting
th«
right:
answer.
'."'•J'
^.'
''-:.'
Note: DoNo!
leave
a
space
between
GO and
TO
.
(some forms of
BASIC
use two
words
Radio
Shack's
BASIC
wants
only
one word).
32

Other manuals for Radio Shack TRS-80

Related product manuals