EasyManua.ls Logo

Commodore Plus 4 - Page 181

Commodore Plus 4
464 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...
Redefining
the
Function
Keys
169
when
you
want
to
use
such
a function
on
a
number,
first
use
STR$
to
convert
the
number
to
a
text
string.
Example:
T$
=
STR$(T):
IP
RIGHT$(T$,3)
The
STR$
function
converts
the
=
".99"
THEM"
T
=
T
+
.01
numeric
value
of
T
into
a
string called
T$.
The
RIGHTS
function
reads
the
three
rightmost
characters
of
T$.
If
these
characters
equal
.99,
.01
is
added
to
the
value
of
T.
After
you
convert
a
number
to
a
text
string,
the
number
loses
its
numeric
properties,
which
means
you
cannot
use
the
number
in
a
calculation.
Instead,
the
computer
treats
the
stringified
number
the
same
way
it
treats
any
text
string.
After
you
finish
using
the
number
as
a
text
string,
you
can
change
it
back
to
a
numeric
value
by
using
the
VAL
function.
The
VAL
function
converts
numbers
in
a
string
into
a
numeric
value.
You
can
use
VAL
to
reverse
a
STR$
function
or
to
extract
numbers
from
any
text-string
expression.
When
you
use
VAL
on
a
text
string
that
contains
both
numbers
and
non-
numeric
characters,
the
computer
converts
only
the
numbers
up
to
the
first
nonnumeric
character.
For
example,
if
you
issue
the
command
PRINT
VAL("34R5"),
the
computer
displays
only
34;
the
5
after
the
R
is
not
displayed
because
the
first
nonnumeric
character
turns
off
the
VAL
function.
Redefining
the
Function
Keys
You
can
redefine
a
function
key
at
any
time
in
immediate
mode
or
within
a
program.
Any
definitions
you
write
are
erased
from
computer
memory
when
you
turn
off
or
reset
the
computer
(unless
you
hold
down
the
RUN/ STOP
key
during
the
reset).
The
KEY
command
lets
you
write
a
definition
for
a
function
key.
The
KEY
command
also
displays
the
current
definitions
of
the
function
keys;
all
redefinitions
written
during
the
current
computing
session
are
displayed
in
this
list.
Follow
these
steps to
redefine
a
function
key:
STEP
1
Type
KEY
and
the
key
number
(to
define
the
HELP
key,
type
an
8)
followed
by
a
comma.
STEP
2
Type
the
text
string
for
the
key
definition:
You
can
define
the
key
to
perform
multiple
tasks
in
BASIC.
Link
multiple
BASIC
commands
and/or
functions
with
plus
signs.
If
a
literal
constant
string
is
used
for
a
key
definition,
it
must
be
in
quotes.

Other manuals for Commodore Plus 4

Related product manuals