Sharp PC-1500A Instruction Manual page 25

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

Advertisement

All
and
more
about
Sharp
PC-1500 at
http:/lwww.PC-1500.info
The
cost of
a widget
is
stored
in
variable
X.
l\ssuming a
6.5%
sales
tax,
what is
the
purchase price ol
the
widgetr :
x - x
+
1.065
Of
course,
we
co uld have
written th
is example
as
P
-
X
*
1.065 in
order to
le<1ve
X
unchanged.
If
we had
stored
the tax rate in
a variable T,
we
could have said X
"
X
*
T
or
P-X*T.
Until now, we
have been using
single letters
as variable names.
This
provided us
with 26
variables
(A
through
ZJ.
In
actuality,
SHARP allows
the
use
of over
950
variable names for single
numbers.
An additional
group of
over 950 variables
may
be
used to
store up
to
16 characters
each.
Finally
(as ii that weren't enoogh), using more
advanced
techniques. users may crute
variables
which hold as many
numbers
or
characters as desired,
limi
ted
only
by
the
amount
of
memory
avai lable
in
the computer.
The
naming-scheme
for
variables
is
simpie and easy
to
learn
.
Names of
numeric variab les
(ones used to hold numbersl
mBy
be
chosen
using
the
following
rules:
The name
may
be
a
letter;
A through Z.
The
name may
b
e
a letter.
followed
by
a
single digit
(0
through
9)
or by another
letter.
Thus.
the
following are valid names for numeric
variables:
S,
01, TX,
MM, Z9,
RO,
E.
!1Q!g_:
Due
to
conflicts with
abbreviations
which have
o
ther
rneanir1gs
in
the
BASIC
language,
SHARP does not
allow
the
use
o
r these variable
names:
LF, IF
, LN,
Pl, TD.
Names of character
variables
(those
used to
hold
character
s)
follow
the same
rules
as
above
except
that
the name ends
with a S
{dollar
sign). The
S alerts
SHARP to
the
fact
that
the
variable
holds
character
information.
The
following
are examples of
valid character
variable
names:
TS,
P2S, T7S,
AAS,
YRS,
XS, ZHS,
65$.
NOTE: Due to
conflicts with
words
which are
part
of
the
BASIC
language,
SHARP docs
not allow
1he use
of these variable
names
:
LFS,
IFS,
LNS,
PIS,
TO$.
It is
important
to understand
that
a variable A and
a variabl<>
AS are two
different variables,
the
first
one can
only hold
a number
and
the second
one can o
nly
ho
ld
characters. As we
shall
sec
later.
SHARP's
BASIC
includes instructions to convert
charatters to
numbers
and
n
umbers to
characters.
To store characters in character
variables
we use
a
variation
of our friend the Assignment
Statement:
character·V.Jriablc~namc
=
"characters''
As
an
example
type
the
following:
0$
"
"DAVY
JONES"
Now
recall
the
contents
of 0$ by
typing
[[}
I
SH1n
I
C
(] l
ENTER
I
DAVY JONES
Do not
sale
this PDF
!!!
23

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents