EasyManua.ls Logo

Apple IIe - Page 75

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
75
ON,
GOSUB Statement
The
ON,
GOSUB statement
is
very similar
in
nature
to
the
ON,
GOTO
statement. The
fqllowing
statement
is
an
example
of
an
ON,
GOSUB statemen1)
100
ON
X GOSUB 1000, 2000, 3000
If
the
value
of
Xis 1,
the
subroutine
at
line
1000
is
executed. If Xis
2,
the
subroutine
at
line
2000
is
executed.
If
Xis 3,
the
subroutine
at
line
3000
is
executed. If X evaluates
to
0
or
to
a
number
greater
than
3,
the
statement
immediately
following
the
ON,
GOSUB
statement
will
be executed.
If
ON,
GOSUB causes a branch
to
a
subroutine,
program
control
will
revert
to
the
line
immediately
following
the
ON,
GOSUB
statement,
once
the subroutine
has
been executed.
Applesoft
BASIC
Functions
Functions are used
in
Applesoft BASIC
to
perform
predefined
calculations
or
operations
on
their
arguments.
All
functions use
the
following
format.
function
(argument)
function
is
the
keyword
for
the
function.
argument
is
a variable,
constant,
or
expression
which
is
to
be stored
in
the
operation
defined
by
the
function.
The
following
statement
is
an
example
of
the
use
of
the
SQR
function.
100
A=
SQR(49)
In this example, A
would
evaluate
at
7.
SQR
is
the
keyword
which
describes
the
square
root
function.
The square
root
of
49
is,
of
course, equal
to
7.
Functions can be used
with
arithmetic, relational, and Boolean
expressions,
as
shown in the
following
statement.

Other manuals for Apple IIe

Related product manuals