EasyManua.ls Logo

Commodore VIC-20 - Page 38

Commodore VIC-20
308 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...
GOTO
or
GO
TO
Format:
Abbreviation:
Screen
Display:
GOTO
line
number
GH![T~i|o
G
|~~
This
simple
statement
allows
the
BASIC
program
to
execute
lines
out
of
numerical
order.
The
word
GOTO
followed
by
a
number
will
make
the
program
jump
to
the
line
with
that
number.
GOTO
cannot
be
followed
by a
variable,
but
must
have
the
line
number
typed
after
the
word
GOTO.
EXAMPLE
1:
10
GOTO
10
Notice
that
the loop
in
the
example
never
ends,
since
the
program
keeps
running
the
same
line
over
and
over.
This
is
called
an
"infinite
loop,"
and
can
be
utilized
when
you
want
a
program
to
stop
in
place
and
wait.
The
only
way
to
stop
an
infinite
loop
is
with
EXAMPLE
2:
10
PRINT
"HELLO";
20
GOTO
10
IF
...
THEN
Format
Choices:
Abbreviation:
Screen
Display:
IF
expression
THEN
line
number
None
None
IF
expression
THEN
statement
This
is
the
statement
that
gives
BASIC
most
of
its
'Intelligence,11
the
ability
to
evaluate
conditions
and
take
different
actions
depending
on
the
outcome.
The
word
IF
is
followed
by
an
expression,
which
can
include
variables,
strings,
numbers,
comparisons,
and
logical
operators.
The
word
THEN
is
followed
on
the
same
line
by
either
a
line
number
or
one
or
more
BASIC
statements.
When
the
expression
is
false,
everything
after
the
word
THEN
on
that
line
is
ignored*
and
22
i

Other manuals for Commodore VIC-20

Related product manuals