HP 35s HP 35s scientific calculator - User Guide - Page 212
Nested Subroutines, Calls subroutine E.
UPC - 000000000000
View all HP 35s manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 212 highlights
If you plan to have only one program in the calculator memory, you can separate the routine in various labels. If you plan to have more than one program in the calculator memory, it is better to have routines part of the main program label, starting at a specific line number. A subroutine can itself call other subroutines. The flow diagrams in this chapter use this notation: 1 Program execution branches from this line to the line number marked 1 ("from 1"). 1 Program execution branches from a line number marked 1 ("to 1") to this line. The example below show you to call a subroutine to change the sign of the number you input. Subroutine E that is called from routine D by line changes sign of the number. Subroutine E ends with a RTN instruction that sends program execution back to routine D (to store and display the result) at line D004. See the flow diagrams below. 1 2 1 Starts here. Calls subroutine E. Returns here. Starts subroutine. Change sign of the number 2 Returns to routine 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 20 levels deep (not counting the topmost program level). The operation of nested subroutines is as shown below: 14-2 Programming Techniques