EasyManua.ls Logo

Commodore Plus 4 - Using Variables

Commodore Plus 4
234 pages
Print Icon
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...
USING
The
example
36*(12+(AZ3))
shows
one
of
the
most
powerful
features
VARIABLES
of
a
comPuter
When
we
used
a
letter
instead
of
a
number
in
a
mathe
matical
problem,
we
used
a
VARIABLE.
A
variable
represents
a
value.
10A
=
3
20
PRINT
"TOTAL:";A
*
4
If
you
RUN
this
program,
the
screen
result
is:
TOTAL
12
There
are
three
types
of
variables
you
can
use
TYPE
Floating
point
Integer
Text
string
SYMBOL
7o
s
DESCRIPTION
real
(decimal)
or
whole
numbers
whole
numbers
letters,
numbers,
and
all
olher
characters
in
quotes
SAMPLE
EXAMPLES
VALUES
X.
AB.
T4
X%,
Al%
X$,
MS$
23.5,
12,
1.3E
+
2
15,
102.3
'TOTAL:-.
"DAYIVCBM"
Every
time
you
want
a
variable
to
be an
integer
variable,
the
symbol
for
that
variable
would
include
the
%
sign.
A
variable
that
contains
text
p^
MUST
end
with
a
S as
part
of
the
variable.
If
it
doesn't
have
that
symbol,
your
Plus/4
considers
it
a
floating
point
number.
A
variable
without
_
either
of
the
symbols
(%
or $)
is
read
as
a
floating
point
number
(a
"regular"
number).
Integer variables
are
a
subset
of
floating
point
vari
ables;
they
are
numbers
with
no
decimal
places
Always
use
the
right
variable
type.
If
you
try
to
do
something
like
assign
___
a
word
to
an
integer
variable,
your
program
won't
work.
This
program
shows
you
what
variable
can
or
can't
be
used
in
a
given
situation,
and
you
can
find
out
what
happens
when
you
try
out
different
types
of
data.
10
REM
THIS
PROGRAM
NEEDS
NUMERIC
DATA
20
PRINT
"ENTER
A
NUMBER"
30
INPUT
x%
I
this
is
the variable
40
PRINT
"NICE
GOING,
ACE!
"
to
be
input
50
PRINT
"I
READ
YOUR
NUMBER
AS";
X%
Try
to
enter
these
values
and
see
what
happens:
ONE
FIFTH
.043
10
64™

Other manuals for Commodore Plus 4

Related product manuals