beautypg.com

Nested subroutines – HP 32SII User Manual

Page 193

background image

Programming

Techniques

13–3

File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm

Starts

here.

"!

%

%

€

1

Calls subroutine Q.

!



2

Return here.

#$

!

Starts D again.



1

Starts subroutine.

.

.

.

!

€

2

Returns to routines D.

Nested Subroutines

A subroutine can call another subroutine, and that subroutine can call yet
another subroutine. This "nesting" of subroutines—the calling of a subroutine
within another subroutine—is limited to a stack of subroutines seven levels
deep (not counting the topmost program level). The operation of nested
subroutines is as shown below:

MAIN program

(top level)

End of program

Attempting to execute a subroutine nested more than seven levels deep
causes an

%

#$

error.