Example:
A Nested Subroutine.
The following subroutine, labeled S, calculates the value of the expression
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.
2
4
6
246
13–4 Programming Techniques
File name 32sii-Manual-E-0424
Printed Date : 2003/4/24
+
+
+
a
b
c
d
2
2
2
Starts subroutine here.
Enters A.
Enters B.
Enters C.
Enters D.
Recalls the data.
1
2
A
.
3
2
A
+ B
5
2
A
+ B
A
Returns to main routine.
135
Nested subroutine
Adds x
Returns to subroutine S.
Size : 17 .7 x 25.2 cm
2
2
.
2
2
+ C
+
+
+
B
C
D
2
2
2
2
2
.