EasyManua.ls Logo

Commodore Plus 4 - Page 21

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...
The
Elements
of
BASIC
9
you
must
put
the
NOT
just
before
the
value
or
comparison
to
negate
or
the
command
will
cause a
syntax
error,
which
always
stops
a
program.
You
might
think
of
NOT
as
changing
the
meaning
of
X
>
Y
to
"unless
X
is
greater
than Y."
The
following
comparisons
show
how
NOT
affects
comparison
operators.
The
comparisons
on
the
right
are
the
same
as
those
on
the
left:
X>Y
same
as
NOTXOY
X<=Y
same
as
NOTX>Y
X
O
Y
same
as
NOT
X
=
Y
X
=
Y
same
as
NOTXOY
The
last
NOT
clause
contains
a
double
negative:
NOT
and
<>
(not
equal).
Double
negatives,
though
discouraged
in
most
English
applications,
are
accept
able
in
BASIC.
But
like
double
negatives
in
English,
double
negatives
in
BASIC
cancel
each
other,
so
NOT
X
O
Y
is
the
same
as
X
= Y.
This
short
program
uses
NOT
to
make
the
opposite
of
the
comparison
opera
tor
typed
in
the
IF
command:
10
INPUT
"WHAT'S
YOUR
AGE";
A
20
IF
NOT
A
=>
21
THEN
PRINT
"USER
IS
A
MINOR":
ELSE
PRINT
"OK"
RUN
WHAT'S
YOUR
AGE
?
20
USER
IS
A
MINOR
RUN
WHAT'S
YOUR
AGE
?
21
OK
The
NOT
makes
the
greater-than-or-equal-to
symbol
mean
this:
unless
A
is
greater-than-or-equal-to
21,
THEN
print
USER
IS
A
MINOR.
The
comparison
is
the
same
as
IF
A
<
21.
Exclusive
OR
(XOR)
The
exclusive
OR,
which
is
called
XOR,
is
not
a
standard
logical
operator.
XOR
is
used
in
machine
language
(EOR),
and
it
is
used
in
the
WAIT
command
to
invert
the
comparison
of
two
bits.
When
both
XORed
bits
have
the
same
value,

Other manuals for Commodore Plus 4

Related product manuals