EasyManua.ls Logo

Sharp PC-1500 - RUN Line·numbcr; Control Statements

Sharp PC-1500
169 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...
A
ll
and more about Sharp PC-1500
at
http://www.PC-1500.info
10
PAUSE "HUMPTY DUMPTY
..
20
PAUSE .. HAD A GREAT FALL"
30
PRINT "BUT
NO
T A
GOOD
SPRING"
40
END
200
PAUSE
"THE
OLD MANS GLASSES"
210
PRINT "WERE FILL
ED
WITH
SHERRY"
220
END
L.2. RUN line·
number
Well,
now
tha
t you
have
t\vo programs in memory, ho\V are you going to
ru
n
each
of them
separately? If
you
a
re
adventurous enough
to
have t
ri
ed
the normal RUN command,
you
..
viii have
discovered
that
it
is
perfectly adequate
to
initiate
the
first program.
(If
you
are
not
adventurous,
try this now).
To
begin
the
second program we need
to
use a variation of the
RUN
co
mmand
which
tells SHARP
on
what
line
to
sta
rt
. This is the RUN line-number command.
To
start
th
e
second program
type:
and voila,
it
is
done
l
Li
ke
rnost helpful
c01'fH
n
ands,
the
RUN
l
in
e·number
comr-r)and
can
ca
use
problerns.
Because
it
instruc
ts
SHARP where
to
begin fo
ll
ow
ing i
nstruc
tions, and because SHARP
is
such an obliging
servont,
programs
ca
n be started in
the
mi
dd
le. This, as you mig
ht
guess, should
not
be done
by
choice.
If
it
is
done,
it
wi
ll
produce some. ah , . , unus
ua
l results, Try it
on
our
ti
rs
t program
by
issuing the conlmand:
RUN
30
This
is
a mild
mist(>ke
compared
to
what
could
happe
n in a
mo
re complex program.
M. CONTROL STATEMENTS
Our
programs
so
tar have
been
a consecutive sequence
of
instructions ea
ch
performed
one
time
by
the
computer.
Those
with
experience giving instructioM may realize
that
this
is
not always
t
he
best way
to
accomplish a task.
Olten
you allow
your
listener
to
choose
on
e
of
several plans.
Sornetimes
you
"condense" your instructi
ons
by
inc
lu
ding a command like, "N
ow
repeat the last
3 steps
un
t il you
are
finished."
These capabilities have been incorporated i
nto
statements
in BASIC called control
natements.
These determine
when,
if, and how
oft
en
other
st;itements will
be
executed.
Contro
l statements
enable
you
to
build
very powerful
and
versatile programs.
In
the n
ex
t few sections we will discuss
the
major control st
atements
of
BASIC;
the
IF
...
THEN,
the
GOTO, and
the
GOSUB.
N. IF and
TH
EN
The
potential f
or
choice within a BASIC program
is
provided
by
the
IF
statement.
A program
equipped with an IF
statement
con evaluate y
ou
r
ir'lpUt
a~d
ma
ke de¢isions:
44
Do
not sale this PDF
!!!

Table of Contents

Other manuals for Sharp PC-1500

Related product manuals