Branching And Conditionals; Branching (Gto) - HP -20S Owner's Manual

Scientific calculator
Hide thumbs Also See for HP-20S:
Table of Contents

Advertisement

To execute the program using 3 and 4 as x; and x,, press
3
4
C. The result is 7.8979. To exit Radians mode, press
(=] (oEG].
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 from within another subrou-
tine—is limited to four levels of subroutines. The operation of nested
subroutines is shown below:
MAIN PROGRAM
(Top level)
(1st level)
(2nd level)
(3rd level)
(4th level)
LBL A
+
|LBL B
+
|LBL C
+
{LBL D
+
||LBL E
RTN
{
'|
RTN
'|
RTN
'|
RTN
w
RTN
END OF PROGRAM
If you attempt to execute a subroutine nested more than four levels
deep, the message Error - Sub appears in the display.
Branching and Conditionals
Branching (GTO)
As we have seen with subroutines,it is often desirable to
transfer execution to a part of the program other than the
next line. This is called branching.
Unconditional branching uses the GTO (go to) instruction to branch to
a program label. Use the keys: (%]
label.
80
6: Programming

Advertisement

Table of Contents
loading

Table of Contents