EasyManuals Logo

HP 12c Platinum Owner's Handbook

HP 12c Platinum
213 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #99 background imageLoading...
Page #99 background image
101
Section 9
Branching and Looping
Although the instructions in a program normally are executed in order of their
program line numbers, in some situations it is desirable to have program
execution transfer or “branch” to a program line that is not the next line in
program memory. Branching also makes it possible to automatically execute
portions of a program more than once – a process called “looping.”
Simple Branching
The i (go to) instruction is used in a program to transfer execution to any
program line. The program line desired is specified by keying its three-digit line
number into the program line containing the i instruction. When the i
instruction is executed, program execution branches or “goes to” the program
line specified and then continues sequentially as usual.
You have already seen a common use of branching: the i000 instruction (that
is stored in program memory after the program you key in) transfers execution to
program line 000. A i instruction can be used to branch not only backward in
program memory – as in the case of i000 and as illustrated above – but also
forward in program memory. Backward branching is typically done to create
loops (as described next); forward branching is typically done in conjunction
with an o or m instruction for conditional branching (as described
afterward).
Looping
If a i instruction specifies a lower-numbered line in program memory, the
instructions in the program lines between the specified line and the i
instruction will be executed repeatedly. As can be seen in the illustration above
under Simple Branching, once the program begins executing the “loop” it will
execute it again and again.
003 causes program execution to
branch to line 003









Table of Contents

Other manuals for HP 12c Platinum

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 12c Platinum and is the answer not in the manual?

HP 12c Platinum Specifications

General IconGeneral
Digits10 digits
Battery typeCR2032
TypeFinancial
Form factorPocket
Weight and Dimensions IconWeight and Dimensions
Weight110 g
Dimensions (WxDxH)79 x 129 x 15 mm

Related product manuals