Conditional Branching - HP 0012C-90001 User Manual

12c financial calculator
Table of Contents

Advertisement

Keystrokes
Keystrokes
Keystrokes
Keystrokes
Ê
t
t(or any key)

Conditional Branching

Conditional Branching
Conditional Branching
Conditional Branching
Often there are situations when it is desirable for a program to be able to branch
to different lines in program memory, depending on certain conditions. For
example, a program used by an accountant to calculate taxes might need to
branch to different program lines depending on the tax rate for the particular
income level.
The hp 12c provides two
conditional branching:
o tests whether the number in the X-register (represented by the
key symbol) is less than or equal to the number in the Y-register (represented
y
by the
in the key symbol). As discussed in Appendix A, the number in the
X-register is simply the number that would, if the calculator were in Run mode,
be currently in the display; and the number in the Y-register is the number
that would, if the calculator were in Run mode, have been in the display
when \ was pressed. For example, pressing 4\5 would place the
number 4 in the Y-register and the number 5 in the X-register.
m tests whether the number in the X-register is equal to zero.
The possible results of executing either of these instructions are:
If the condition tested for is true when the instruction is executed, program
execution continues sequentially with the instruction in the next line of
program memory.
If the condition tested for is false when the instruction is executed, program
execution skips the instruction in the next line of program memory and
continues with the instruction in the following line.
These rules can be summarized as "DO if TRUE".
Section 9: Branching and Loopin
Section 9:
Section 9:
Section 9:
Display
Display
Display
Display
Line 07: g(02.
07- 43, 33
02
This is the end of the second pass
through the loop.
–12.23
–530.99
Portion of third month's payment
applied to interest.
–12.36
Portion of third month's payment
applied to principal.
–12.36
Halts program execution.
conditional
test instructions that are used in programs for
Branching and Looping g g g
Branching and Loopin
Branching and Loopin
107
107
107
107
x
in the

Advertisement

Table of Contents
loading

Table of Contents