Statements; Line Numbers - Sharp PC-1500 Instruction Manual

Hide thumbs Also See for PC-1500:
Table of Contents

Advertisement

All
and
more
about Sharp
PC-1
500 at
http://www.PC-1500.info
Our
one·line
program
is complete. Change to
the
RUN
mode and
wpe:
This command
instructs
SHARP to
be<Jin processing
the statements (or,
in
this case,
the statement)
in
our program. Following orders, SHARP prints:
[
,
_ ,oon
O(
G
•••
on
the
display. (Press
ENTER to
inform SHAR:P
when
you
are
through rcadin!J).
To make any
additions,
changes
or
deletions to
our
program we
must return to
the PROgram
mode.
If
our program had contained
an
error and
had not
completed successfully,
it
would
have
been necessary to
return
to the PROgram mode
to
correct the
offending
statement.
Thus,
work on programs
is
accomplished in
the
PROgram mode, while
the
execu
tion and testing
of
programs is performed
in the
RUN
mode.
C. COMMANDS VS. STATEMENTS
You
may
have
noticed
in
the previous example that we communicated our desires
to
SHARP
by
two
different methotls.
The instructions
NEW and
RUN
were
performed
immediately
after
we
prr.ssed ENTER.
This
type of
instruction
is known
as a
command.
The
PRINT
instruction,
on
the other
hand.
was somewhat
different. It was
entered
in
the
PROgram
mode,
was preceeded by
a
number
(101.
and was
not executed
immediately,
This
type
of
instruction is known
as
a
state·
ment.
In
some sense,
the commands tell
SHARP
what to
do with
the
statements.
For example, the
NEW command wil
I
erase
all currently saved statements.
It
is
important to remember
that
commands
may
not be used
within
a
program
whereas statements
almost
(but not quite) always
are
grouped to form
a
program.
D.
LINE
NUMBERS
A
BASIC
program consists of a
series of
numbered
lines
each containing
one
or more
state·
ments.
The
'"line numbers"
are
used by
SHARP to
maintain
the correct sequence during
execution but do
not
become pan of
the
output when the program is
run.
Statements
may
be
entered in any order but are processed by the computer
sequentially
by
line
number
(subi~t
to
modification, as we shall see
later).
As a
demon,
s tration. let's add
a
statement
to
our previous one·line program. Switch
to
the
PROgram
mode
and type:
Keystrokes:
mm
rn
moo rn
1
••
,"
1
~
c:orn mm
crJ
lsr•Cfl
l:;1nFTI
CJ
ISH1nl
CJ
!••<TERI
27
Do not
sale
this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents