Sharp PC-1500 Instruction Manual page 25

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

Advertisement

All
and
more
about Sharp
PC-1500
at
http://www.PC-1500.info
The cost
o
f
a widget
is
stored
in
variable X. Assuming a
6.5%
sales
t~x. wh~t
is
the
purchase price
o
f
the
widget? :
x
=
x
*
1.065
Of course,. we could have
.
w ritten
this example as
P
=
X
*
1.065
in
o rder
to
leave 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,
\•Je
have been using single
letters
as
variable
names.
This provided us
w ith 26
variables (A th rough
Z).
In actuality, SHARP allows
the use
of over 950
variable
names
fo
r
single
numbers.
An
ad~ditional
group of over 950 1Jariables
may
be
used to store
up to 16
characters
each.
Finally
(as
if
that
\vercn't
enough), using more
advanced
techniques, users may create var-iables
v1hich
hold
as
many
numbers or characters as desired,
limited only by the
amount of memory
available
in
the
computer.
The
naming-scheme for variables
is simple
and
easy
to
learn
.
Names
of numeric variables
{ones
used
to
ho'
l d
numbers)
may
be
chosen usin!1
the
following rules:
-
The
name may be
a letter;
A
through
Z
.
-
The
name may
be
a
letter,
followed by
a
single
digit
(O
through
9)
or
by
another
letter.
Thus. the following
are valid names
for
numeric
variables:
S,
0
1,
TX
,
MM,
Z9,
RO,
E.
NOTE:
Due
to
conflicts
with abbreviations which
have other meanings
in
the BASIC
language,
SHARP does not allow
the
use of these
var
iable names:
LF,
IF,
LN,
Pl,
TO.
Names
of character
variables {those used to
hold
characters) follow
the
same rules as
above
except that the name
ends
with
a$
(dollar
sign}. The$
alerts SHARP to
the
fact
that
the variable
holds
character
information.
The
following
are examples of valid character variable names:
T$,
P2$,
T7S,
AAS,
YRS,
XS, ZHS, B5S.
NOTE: Due to
conflicts
with
words
which
are part of
the
BASIC
language,
SHARP
does
not allow
the use of these variable
names:
LFS,
IFS,
LNS,
PIS,
TDS.
It
is
importarnt
to
understand
that a
v.:iriable
A and
a
variable
AS
are two different variables, the
first one can only hold a number
and
the
second
one
can
only hold characters. As we shall see
later,
SHARP's
BASIC
includes instructions
to convert characters to
numbers and
numbers
to
characters.
To store characters in character variables i.ve use
a
v.:iriation
of
our
friend
the Assignment
Statement:
ch;:iracter.variable·name
=
"characters
''
As an example
type the
following:
OS
=
"DAVY JONES"
Now
recall
the contents of OS by
tyring
(][)
rn
I
ENTER
I
DAVY JONES
23
Do not sale this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents