EasyManua.ls Logo

Apple IIe - Page 73

Apple IIe
320 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...
Applesoft
BASIC
Programming
73
In
our
preceding
example,
if
the
value
input
for
A
has
a zero
value, then
the
program
will
branch
to
line
900 where
the
operator
will
be
prompted
whether
he
has
finished
entering
data.
In
line
910,
the
program
will
set
up
a
condition
where
if
the
input
was
'N',
the
program will branch
to
line 100.
If
the
entry
was
not
equal
to
'N',
the
program
will
continue
to
line 999 where
it
will
end.
~
Note
in
line
910 that a
GOTO
statement
is
not
used
to
precede
the
line
number
being
branched
to.
When
a
line
number
is
indicated
following
a THEN statement,
the
computer
does
not
require
the
presence
of
GOTO,
which
is
" assumed.
ON,
GOTO Statement
The
ON,
GOTO
statement
is
a
combination
of
a
conditional
statement and a
branching
statement. The
use
of
the
ON,
GOTO
statement
is
illustrated in
the
following
program.
10 INPUT A
20
ON
A
GOTO
40, 50
30
GOTO
99
40 PRINT
"A=
1":
GOTO
99
50 PRINT
"A=
2"
99 END
If
the
variable
or
expression
following
ON
evaluates
to
1,
program
control
branches
to
the
first line
number
specified after
GOTO;
if
2,
to
the
second;
if
3,
to
the
third,
etc.
If
the
variable
or
expression evaluates
to
a
number
greater than
the
number
of
line
numbers
following
GOTO,
program
control
will
branch
to
the
statement immediately
following
the
ON,
GOTO
statement. This
is
also
the
case
if
the
variable
or
expression
following
ON
evaluates
to
zero.
Subroutines & GOSUB Statements
Many
times you
will
find
that the same
set
of
program instructions
are used
more
than
once
in
a program. Re-entering these
instructions
throughout
the
program can be very
time
con-

Other manuals for Apple IIe

Related product manuals