EasyManua.ls Logo

HP HP-32S - Nested Subroutines

HP HP-32S
312 pages
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...
Nested
Subroutines
A
subroutine
can
call
another
subroutine,
and
that
subroutine
can
call
yetanothersubroutine.
This
'nesting"of subroutines—the calling of a
subroutine
within
another
subroutine—is
limited
to
a
stack
of
subrou
tines seven levelsdeep (not counting the topmost program
level).
The
operation of nested subroutines is as shown
below:
Main program
(top
level)
LBL
R
.
LBL
B
LBL
C
,
LBL
D
I
LBL
E
XEQ
B
I4
XEQ
C
XEQ
0
[/
XEQ
E
V
SIN
K
3.1416
K
SQRT
IN
RCL
R
h
RTN
+
RTN
V
RTN
V
RTN
7
RTN
End
of
program
Attempting
to
execute
a
subroutine
nested
more
than
seven
levels
deep causes an
XEQ
OVERFLOW
error.
Example: A Nested Subroutine. The
following
subroutine, labeled
S, calculates
the
value of the expression
Vfl2
+
b2
+
c2
+
d2
as part of a
larger
calculation
in a
larger
program.
The
subroutine
calls
upon
another
subroutine
(a
nested
subroutine),
labeled
Q,
to
do
the
repetitive
squaring
and
addition.
This
keeps
the
program
shorter
than
it
would
be
without
the
subroutine.
92
6:
Programming
Techniques

Table of Contents

Related product manuals