EasyManua.ls Logo

Commodore 128D - Page 48

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...
<
/
Now
there
are
two
variables,
labeled
A
and
B,
in
the
computer's
memory,
containing
the
numbers
300
and
600
respectively.
If,
later
in
-
-
the
program,
you
want
to
change
the
value
of
a
variable,
just
put
1
i
another
assignment
statement
in
the
program.
Add
these
lines
to
the
program
above
and
RUN
it
again.
-
50
A
=
900*30/10
UJ
60
B
=
95+
32+
128
70
GOTO
30
£j
You'll
have
to
press
the
STOP
key
to
halt
the
program.
Now
LIST
the
program
and
trace
the
steps taken
by
the
computer.
I
i
First,
it
assigns
the
value
to
the
right
of
the
=
sign
in
line
10
to
the
letter
A.
It
does
the
same
thing
in
line
20
for
the
letter
B.
Next,
it
-
-
prints
the
messages
in
lines
30 and
40
that
give
you
the
values
of
A
LJ
and
B.
Finally,
it
assigns
new
values
to
A
and
B
in
lines
50
and
60.
The
old
values
are
replaced
and
cannot
be
recovered
unless
the
-
-
computer
executes
lines
10
and
20
again.
When
the
computer
is
*
i
sent
to
line
30
to
begin
printing
the
values
of
A
and
B
again,
it
prints
the
new
values
calculated
in
lines
50
and
60.
Lines
50
and
60
reas-
^-
-
sign
the
same
values
to
A
and
B
and
line
70
sends
the
computer
<
i
back
to
line
30.
This
is
called
an
endless
loop,
because
lines
30
through
70
are
executed
over
and
over
again
until
you
press
the
}
RUN/STOP
key
to
halt
the
program.
Other
methods
of
looping
are
Lj
discussed
later
in
this
and
the
following
two
sections.
Strings
A
string
is
a
character
or
group
of
characters
enclosed
in
quotes.
\
\
These
characters
are
stored
in
the
computer's
memory
as a
variable
^
in
much
the
same
way
numeric
variables
are
stored.
You
can
also
use
variable
names
to
represent
strings,
just
as
you
use
them
to
rep-
\
/
resent
numbers.
When
you
put
the
dollar
sign
($)
after
the
string
vari-
'—'
able
name,
it
tells
the
computer
that
the
name
is
for
a
string
variable,
and
not
a
numeric
variable.
\
"1
Type
NEW
and
press
RETURN
to
clear
your
computer's
memory,
_
then
type
in
the
program
below:
)
1
10
A$
=
"COMMODORE"
20X
=
128
}
30
B$
=
"
COMPUTER"
U
40Y
=
1
50 ?
"THE
"A$;X;B$"
IS
NUMBER
"Y
40
USING
C128
MODE-Getting
Started
in
BASIC

Table of Contents

Other manuals for Commodore 128D

Related product manuals