EasyManua.ls Logo

Commodore Plus 4 - Page 20

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...
8
The
BASIC
Language
Logical
OR
OR
requires
only
one
of
the
two
conditions
to
be
met
for
the
compound
expres
sion
to
be
true.
An
ORed
comparison
is
false
only
when
both
values
are
false.
For
example
10
INPUT
"AGE,
ANNUAL
INC0ME";X,
Y
20
IF
X=>60
OR
Y<=10000
THEN
PRINT
"ELIGIBLE":
ELSE
PRINT
"INELIGIBLE"
RUN
AGE,
ANNUAL
INCOME
?
60,
15000
ELIGIBLE
RUN
AGE,
ANNUAL
INCOME
?
65,
9900
ELIGIBLE
RUN
AGE,
ANNUAL
INCOME
?
55,
12000
INELIGIBLE
This
modification
of
the
previous
program
shows
the
difference
between
AND
and
OR.
In the
first
program,
the
input
60
and
15000
makes
the
IF
command
false
because
both
conditions
must
be
met
before
the
IF
command
is
true.
In
the
second
program
with
OR
in
the
IF
command,
the
same
input
makes
the
IF
command
true
because
only
one
of
the
two
conditions
has
to
be
met
for
the
whole
IF
command
to
be
true,
the
third
execution
shows
that
the
only
time
ORed
IF
commands
are
false
is
when
NEITHER
condition
is
met.
Logical
NOT
NOT
is
somewhat
different
from
AND
and
OR.
NOT
does
not
compare
two
values.
Instead,
NOT
lets
you
negate
any
value
or
comparison
operator.
For
example,
we
will
add
NOT
to
an
IF
command
that
compares
a
value
to
see
if
it
is
greater
than
another
value:
IF
NOT
X
>
Y.
Without
the
NOT,
this
command
checks
to
see
if
X
is
greater
than
Y.
When
NOT
is
added,
this
command
checks
to
see
if
X
is
NOT
greater
than
Y;
in
other
words,
if
X
is
less
than
or
equal
to
Y.
When
you
use
NOT,
you
must
type
NOT
before
the values
you
are
comparing.
This
may
seem
awkward
because
we
would
say
"if
X
is
NOT
greater
than
Y,"
but

Other manuals for Commodore Plus 4

Related product manuals