EasyManua.ls Logo

Commodore 128D - Page 281

Commodore 128D
427 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...
INPUT
These
forms
transfer
program
execution
to
the
specified
line
number
if
the
expression
is
true.
Otherwise,
the
program
resumes
with
the
program
line
number
immediately
following
the
line
containing
the
IF
statement.
EXAMPLE:
50
IF
X
>
0
THEN
PRINT
"OK":
ELSE
END
This
line
checks
the
value
of
X.
If
X
is
greater
than
0,
the
statement
immediately
following
the
keyword
THEN
(PRINT
"OK")
is
executed
and
the
ELSE
clause
is
ignored.
If
X
is
less
than
or
equal
to
0,
the
ELSE
clause
is
executed
and
the
statement
immediately
following
THEN
is
ignored.
10
IF
X
=
10
THEN
100
20
PRINT
"X
DOES
NOT
EQUAL
10"
99
STOP
100
PRINT
"X
EQUALS
10"
This
example
evaluates the
value
of
X. IF
X
equals
10,
the
program
control
is
transferred
to
line
100
and
the
message
"X
EQUALS
10"
is
printed.
IF
X
does
not
equal
10,
the
program
resumes
with
line
20,
the
C128
prints
the
prompt
"X
does
not
equal
10"
and
the
program
stops.
—Receive
a
buffered
data
string
or
a
number
from
the
keyboard
and
wait
for
the
user
to
press
RETURN
INPUT
["prompt
string";]
variable
list
The
INPUT
statement
asks
for
data
from
the
user
while
the
program
is
RUNning
and
places
the
data
into
a
variable
or
variables.
The
pro
gram
stops,
prints
a
question
mark
(?)
on
the
screen,
and
waits
for
the
user
to
type
the
answer
and
hit
the
RETURN
key.
The
word
INPUT
is
followed
by
a
prompt
string
and
a
variable
name
or
list
of
variable
names
separated
by
commas.
The
message
in
the
prompt
string
inside
quotes
suggests
(prompts)
the
information
the
user
should
enter.
If
this
message
is
present,
there
must
be
a
semicolon
(;)
after
me
closing
quote
of
the
prompt.
273
BASIC
7.0
ENCYCLOPEDIA—Basic
Commands
and
Statements

Table of Contents

Other manuals for Commodore 128D

Related product manuals