EasyManua.ls Logo

Commodore 128D - Inputting Data; The INPUT Command; Assigning a Value to a Variable

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...
i
i
Inputting
Data
/
\
i
i
i
I
/
\
The
computer
will
count
backward
from
100
to
0,
in
units
of
10.
If
you
don't
use
a
STEP
command
with
a
FOR
statement,
the
com
puter
will
automatically
increment
the
counter
by
units
of
1.
The
parts
of
the
FOR-NEXT
command
in
line
10
are:
FOR
word
used
to
indicate
beginning
of
loop
X
counter
variable;
any
number
variable
can
be
used
1
starting
value;
may
be
any
number,
positive
or
nega
tive
TO
—connects
starting
value
to
ending
value
100
ending
value;
may
be
any
number,
positive
or
negative
STEP
indicates
an
increment
other
than
1
will
be used
-10
increment;
can
be
any
number
positive
or
negative
The
INPUT
Command
Assigning
a
Clear
the
computer's
memory
by
typing
NEW
Value
to
a
and
pressing
RETURN,
and
then
type
and
RUN
Variable
this
program.
10K
=
10
20
FOR
1
=
1
TO
K
30
?
"COMMODORE"
40
NEXT
In
this
program
you
can
change
the
value
of
K
in
line
10
to
make
the
computer
execute
the
loop
as
many
times
as
you
want
it
to.
You
have
to
do
this
when
ypu
are
typing
the
program,
before
it
is
RUN.
What
if
you
wanted
to
be
able
to
tell
the
computer
how
many
times
to
execute
the
loop
at
the
time
the
program
is
RUN?
In
other
words,
you
want
to
be
able'to
change
the
value
of
the
variable
K
each
time
you
run
the
program,
without
having
to
change
the
program
itself.
We
call
this
the
ability
to
interact
with
the
computer.
You
can
have
the
computer
ask you
how
many
times
you
want
it
to
execute
the
loop.
To
do
this,
use
the
INPUT
command.
For
exam
ple,
replace
line
10
in
the
program
with:
10
INPUT
K
55
USING
C128
MODE-Advanced
BASIC
Programming
I
j

Table of Contents

Other manuals for Commodore 128D

Related product manuals