Sharp PC-1500A Instruction Manual page 47

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

Advertisement

All
and more about Sharp
PC-1500
at http://www.PC-1500.info
Program Listing:
10 PAL.iSE "AAE YOU ASLEEP?"
20 INPUT
"TYPE YES
OR NO
"; SXS
30
IF
SX$
=
"YES" THEN PRINT
"OH.
SORRY
TO
DISTURB YOU"
4
0
END
Keystrokes:
CDOD
m
muom
m
1
...
,,.,
c:Jmoo
CD l•••c•t
moo
o:o
,
...
c,1
m
rn mm
mm
'"
"'
"
' m
rn m
CD
OD
m
o;o
CD'
'"'"
1c:::i
CDrnmm
1
s ..
C£1
GJ CD
m
!SPACE!
@J
OD
lsPAC<l
OD
[Q:)
l•••c•I
!
SHI
FT
!
c::J
I SJtlFTI
co[[]
rn
lsHIFT
I
rn
1
ENTERI
moo
comm
m
1
..
,,,
1rn
1
=
,
,
•• ,,,
,
c:::i
rn
m
m
1
••"''
c:::i
CD
!JD
rn ao m
OD
CD
OD
CD
I°"'"
I
c:J
[QJ
[Kl
JSHon
l
G:J
!SP•C<j ([J
[l[)O!J
(JD
[D
!SP•<•IC!J
Cl[)
1 •••«1
oocom rnoomrn
1
s
..
cc1
rnoooo
I
SHIFT
I
c:J
IEHTft:l
I
moo CD OD 00
l••n•I
This soporific program will
only
produce output
if
you
answer
affirmatively.
The
general fo
rm
of the
IF
statement. which
lin~
30
illustrates. is:
IF condition THEN
statement
During
execution.
the test embedded in
the
IF clause
is
performed.
Whether
the
statement is
performed, or
not,
depends
on
the
result
of the test. The test
is
usually an inequality
and is called
a
" condition."
Remember that inequalities are comparisons
which are
either
True
or
False.
If
the
inequality is
True
then th.,
statement
is
executed.
If
the
inequality
is
False
then the
statement
is
skipped.
In our sample
program
the
test
is whether the variable SXS
is
equal to
(contains) the
character
string
"YES".
If
it
does.
and
o
nly
if it does, then the
PRINT
instruction
is
followed.
If
SXS is
not
equal
to
"YES",
then the
PRINT
instruction
is
ignored.
In
either case. no matter whether the PR INT
statement is
executed
or ignored, SHARP will
proceed,
as normal
.
to the next line. (I
n
our sample
program
the
next
line
is
line
40)
.
Notice that
we
could have
reversed
our te.t by
altering
several lines
in
the following manner:
30
IF
SXS
="
NO"
THEN
END
40
PRINT
"OH, SORRY
TO
DISTURB YOU"
This
progn.lm,
however. is
not
quite the same as the
o
riginal.
It
allows
our
apologetic computer
to
talk
with
anyone
who mistypes
or
who doesn't
answer
with a
"
NO".
In
addition.
this
pro
g ran'I
really
has
two
endpoints;
the END
statement in
line
30
and
the implied
END beyond
line
40.
Do not
sale
this PDF
!!!
45

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents