EasyManua.ls Logo

Commodore 16 - Page 63

Commodore 16
94 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...
GRAPHIC CLR
GRAPHIC CLR
This
is actually
a
lorm of
the
GRAPHIC statement;
instead of
specifying
a
mode
to use graphics, this statement clears the 10* of memory
allocated
to
the graphic area,
and
that
memory space becomes
available for BASIC once again
IF . . . THEN . . :ELSE
IF expression THEN then-clause [:ELSE else-clause]
IF THEN lets the computer analyze
a
BASIC expression
preceded
by IF and lake
one
of
two
possible
courses of action. If the expression
is true, the statement following THEN
is executed. This
expression
may
be
any
BASIC statement. If the expression is false, the program
goes
directly
to the next
line, unless an
ELSE clause is present. The
expression being evaluated may
be a
variable or formula. In
which case
It is considered
true
if
nonzero, and false if zero. In most cases, there Is
an expression involving relational
operators (• , <, >,
<«, >-.
<>,
AND. OR. NOT).
The
ELSE
clause.
It present,
must
be In the same
line
as the IF-THEN
pan When
an ELSE
clause is present.
It
is executed
when the
THEN
clause
isn't executed.
In
other words, the
ELSE
clause
executes
when
the
IF
expression is FALSE
1^1
i
i i
[
(
[
!
(
(
[
I
I
I
[ (
I
I
No
\
1
OK
Cneck
0?
E w
End
I
I
I
I
I
I
I
! I
I
i
I
I
: I
I
(
EXAMPLE
50 IF X>0 THEN
PRINT"OK":
ELSE END
Checks the value ol X. II X Is
greater lhan 0, the THEN clause
is executed, and
the
ELSE
clause
isn't. If X is not
greater than
0.
the ELSE
clause is executed and
the THEN clause
Isn't.
INPUT
INPUT ["prompt string".] variable list
The
INPUT statement allows the compute'
to
ask for data from the
person running the program and place II
into
a
variable
or
variables.
The program
stops,
prints
a
Question mark
(?)
on the screen, and wails
for
the
person
to
type Hie answer and press the BETUHN key
The word
INPUT
is followed
by a
variable name or list of variable
names separated
by
commas. There may be
a
message Inside
quotes before the list of variables lo be input. If this
message (called
a
prompt)
is present, there must
be a
semicolon
(,)
after the closing quote
of the prompt. When more than one variable
is
to be
INPUT.
Ihey
should be separated by commas
when
typed
In If not. the computer
asks for
the
remaining values
by
printing two question marks
{??)
II
yoj
press the BETurn key
witnout
INPUTting values, the
INPUT
variables retain
the values previously held
for
those
variables This
statement
can only
be executed
within
a
program.
EXAMPLE:
10 INPUT "WHAT'S YOUR NAME";At
20 INPUT "AND YOUR
FAVORITE COLOR"; B$
30 INPUT "WHAT'S THE AIR SPEED OF A SWALLOW";A
122
[ f
123

Other manuals for Commodore 16

Related product manuals