Programming
Techniques
13–3
File name 33s-English-Manual-040130-Publication(Edition 2).doc Page : 388
Printed Date : 2004/1/30 Size : 13.7 x 21.2 cm
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.
Example:
A Nested Subroutine.
The following subroutine, labeled S, calculates the value of the expression
2
2
2
2
d
c
b
a
+
+
+
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 saves memory by keeping the program shorter than it would be
without the subroutine.
Summary of Contents for 33S
Page 14: ......
Page 15: ...Part 1 Basic Operation ...
Page 16: ......
Page 56: ......
Page 64: ......
Page 82: ......
Page 92: ......
Page 122: ......
Page 138: ......
Page 157: ...Part 2 Programming ...
Page 158: ......
Page 184: ......
Page 210: ......
Page 222: ......
Page 293: ...Part 3 Appendixes and Reference ...
Page 294: ......
Page 324: ......
Page 348: ......