HP 12C#ABA hp 12c_user's guide_English_E_HDPMBF12E44.pdf - Page 107
Conditional Branching
UPC - 492410746430
View all HP 12C#ABA manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 107 highlights
Section 9: Branching and Looping 107 Keystrokes Ê t t(or any key) Display 07- 43, 33 -12.23 -530.99 -12.36 -12.36 02 Line 07: gi02. 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. 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 test instructions that are used in programs for conditional branching: z o tests whether the number in the X-register (represented by the x in the key symbol) is less than or equal to the number in the Y-register (represented by the y 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. z m tests whether the number in the X-register is equal to zero. The possible results of executing either of these instructions are: z 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. z 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". File name: hp 12c_user's guide_English_HDPMBF12E44 Printered Date: 2005/7/29 Page: 107 of 209 Dimension: 14.8 cm x 21 cm