HP 15c User Manual

Page 110

Advertising
background image

110 Section 10: The Index Register and Loop Control

For example, the number 0.05002 in a storage register represents:

nnnnn x x x y y

0.0 5 0 0 2

Start count at zero.

Count by twos.

Count up to 50.

I and e Operation. Each time a program encounters I or
e it increments or decrements nnnnn (the integer portion of the loop
control number), thereby keeping count of the loop iterations. It compares
nnnnn to xxx, the prescribed test value, and exits the loop by skipping the
next line if the loop counter (nnnnn) is either greater than (I) or less
than or equal to (e) the test value (xxx). The amount that nnnnn is
incremented or decremented is specified by yy.

With these functions (as opposed to the other conditional tests), the rule is
―Skip if True‖.

False (nnnnn

xxx)

True (nnnnn > xxx)

instruction

´IV

loop

t.

1

instruction

exit loop

For I: given nnnnn.xxxyy, increment nnnnn to nnnnn + yy, compare
it to xxx, and skip the next program line if the new value satisfies nnnnn >
xxx. This allows you to exit a loop at this point when nnnnn becomes
greater than xxx.






Advertising