Download  Print this page

Nested Subroutines - HP 35s User Manual

Scientific calculator.
Hide thumbs


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
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.
  
  
  
  
  
 
  
 
 

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:
Programming Techniques
Program execution branches from this line to the
line number marked  1 ("from 1").
Program execution branches from a line number
 2
 1
1 ("to 1") to this line.
Starts here.
Calls subroutine E.
Returns here.
Starts subroutine.
Change sign of the number
Returns to routine D.


Table of Contents

   Related Manuals for HP 35s

This manual is also suitable for:

F2215aa - 35s scientific calculator

Comments to this Manuals

Symbols: 0
Latest comments: