EasyManua.ls Logo

Commodore Plus 4 - Page 176

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...
164
Some
Programming
Techniques
be
created
with
a
literal
string
constant
consisting
of
only
a
pair
of
quotation
marks
(with
nothing
between
them).
Input
from
keys
on
the
keyboard
is
considered
to
be a
text
string,
so
you
must
use
a
text-string
variable
to
read
a
key.
For
example,
you
must
use
a
string
variable
in
the
GETKEY
command
to
tell
the
computer
to
accept
a
single
pressed
key
as
input.
Note:
It
is
possible
to
use
a
numeric
variable
with
a
GETKEY
command.
Pressing
a
digit
(0-9)
results
in
that
single
digit's
value
being
assigned
to
the
numeric
variable.
Pressing
any
other
key
results
in
an
error.
The
error
aborts
the
program
unless
it
is
TRAPped.
Combining
String
Values
You
can
use
the
plus
sign
to
concatenate
multiple
text
strings,
including
string
variables
and
string
functions.
When
you
are
combining
text
strings,
you
must
type
the
plus
sign
outside
the
quotes
(e.g.,
"DATA"
+
"BASE").
Concatenated
strings
are
compressed
into
one
value.
No
spaces
are
added
between
two
strings
(e.g.,
"DATA"
+
"BASE"
equals
"DATABASE").
The
strings
are
concatenated
from
left
to
right.
Use
the
plus
sign
in
compound
function
key
definitions.
For
example,
to
define
a
function
key
to
list
and
then
run
a
program,
you
can
use
the
following
definition:
KEY
3,
"LIST"
+
CHR$(13)
+
"RUN"
+
CHR$(13)
The
plus
sign
is
the
only
arithmetic
operator
you
can
use
with
text
strings.
You
cannot
use
the
minus
sign
to
remove
characters
from
a
string;
instead,
use
the
RIGHTS,
LEFTS,
and
MIDS
functions
to
get
substrings.
Comparing
String
Values
You
can
use
text
strings
in
comparisons
just
as
you
use
numbers.
All
six
compari
son
operators
(=,
<>,
>,
<, <=,
and
>=)
can
be
used
to
compare
text
strings.
You
cannot
compare
a
text
string
or
text-string
variable
with
a
numeric
value.
If
this
illegal
comparison
is
attempted,
a
TYPE
MISMATCH
error
aborts
the
program
unless
it
is
TRAPped.
When
you
use
the
equal
or
not
equal
signs
to
compare
text
strings,
the
computer
reads
the
strings
character
by
character,
checking
for
an
exact
match,
including
blank
spaces.
For
example,
"STRING"
<>
"STRING"
is
true
be
cause
the
second
string
contains
a
blank
space
that
is
not
present
in
the
first
string.

Other manuals for Commodore Plus 4

Related product manuals