HP (Hewlett-Packard) 32SII Calculator User Manual


 
Programming Techniques 13–5
File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm
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. It is not possible to branch to a specific line number during a
program.
A Programmed GTO Instruction
The GTO label instruction (press
z
U
label) transfers the execution of a
running program to the program line containing that label, wherever it may
be. The program continues running from the new location, and never
automatically returns to its point of origination, so GTO is not used for
subroutines.
For example, consider the "Curve Fitting" program in chapter 16, The
!
'
instruction branches execution from any one of three independent initializing
routines to LBL Z, the routine that is the common entry point into the heart of
the program: