EasyManua.ls Logo

Sharp PC-1500 - Goto

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 P
C-
1500 at http://www.PC-1500.info
Several endings are
not
the result
of
good programming practice. Our revers.al
or
these
stat
eme
nts
docs d
emo
nstrate though, that correct ordering
of
statements and proper testing are necessary
for
a program
to
opcr~tc
correctly.
In
the
next
section, we will
observe
a third
way
to
phrase
our
program which invo
lves
the
GOTO statement and solves the problems
of
the seconcJ version.
Although
the
condition
of
an
IF
statement
is
usually an inequality,
it
is
not
necessarily so. In
PC
·
150
0 BASIC
any
expression which evaluates
to
a
pos
itive. non-zero. number is considered
to
be True. Any cxp:rcssion. such as 5-
9,
which evaluates to zero or a negative number is considered
to
be False. This explains why inequalities work
as
condition
s:
remember
that
an inequality
which
is
True r
et
u
ir
ns a 1 and inequalities t
hat
;;ire
· False retu
rn
a
O.
This method
of
representing
Tr
ue
and False is
not
standard
on
all
computers
~nd
c~n
p
ro
d
uc
e obscure programs. Use this
facility judiciously.
One
mo
re reminder
is
in
order.
If the
statement
which fo
ll
ows
the
THEN
i$
an
assignment
statement, the LET
ke
yword MUST be used. Failure to
do
so wi
ll
cause an ERROR condition
to
occu
r.
This was d;,;cussed in
the
section
on
the
LET
statement.
0.
GOTO
You may
ha
ve
noticed.
in t
he
last section. that
our
opt
ions
we
re limited
af
ter
the
test was made
in
the
IF
stacemet.
We
were only allowed
to
execute
one
stateme
nt
if the conditi
on
was True.
For conven
ie
nce.
we
would
li
ke
to
execute
several statements. The GOTO stat
emen
t a
ll
o1wvs
us to
do
this.
Th
e GOTO
statement
modifies
the
"flow
"
of
statement
executi
on.
It tells SHARP to "go
to"
a line
ot
her than
the
next
one
and
begin executing statements sequentia
ll
y from
the
re. The
effect
of
this
"jump
"
is
th
at
some
state
ments
may
be skipped entirely.
For
ex
ampl
e review
the
following program:
P
ro
gram Listing:
10
PAUSE " E
SC
HEW
'"
'
20
GOTO
50
30
PR
I
NT
X*3
/ 4
.,
· 2
4.0 PRINT "A BOOK WHICH
EMPLOYS" ;
so
PRINT
"OBFUSCATION!"
60
E
ND
Key
stro
ke
s:
rn
oorn OD
rn
oo
m uo 1 ,
••
1
rn
oo m
no
co
OD
m m
rn
rnrn
rn
1
+i
m (•NTE•I
m
rn
mm
co
OD
m '
"'"'
1
c:::J
oo 10
..
c.
1 oo
rn
OD
m
!•••c•I
oo
OD
com
OD r
s..c
I CD rn:i
mm
CQJ
m
m1
sHJFr l c:J !S
Hlf
TI
CD
I
ENTE.n
l
m
oommco
OD
CD•
u••I c::JCQJill
mrnoom
m
CD
co
I][)
[NJ I
sm
rr
l
CD
I
SHlfT
I
CJ
lfNTfAl
rnrn
m
ODrul•
..
•I
46
Do
not sale this PDF
!!!

Table of Contents

Other manuals for Sharp PC-1500

Related product manuals