104
Section 9: Branching and Looping
Keystrokes
Display
Ê
002,
1.00
Ê
003,
–531.12
Ê
004,
–531.12
Ê
005,
–12.23
Ê
006,
–12.23
Ê
007,43,33,002 Line 007: gi002.
–12.23
t
–530.99
–12.36
t(or any key)
–12.36
a
More precisely, the number in the X-register.
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.
0 Line 002: :0. Program
45
execution has branched to the
beginning of the loop for the
second pass through it.
11 Line 003: f!.
42
Portion of second month's
payment applied to interest.
31 Line 004: gu.
43
34 Line 005: ~.
Portion of second month's
payment applied to principal.
31 Line 006: gu.
43
This is the end of the second pass
through the loop.
Portion of third month's payment
applied to interest.
Portion of third month's payment
applied to principal.
Halts program execution.