Loops with counters (dse, isg) – HP 32SII User Manual

Page 207

Advertising
background image

Programming

Techniques

13–17

File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm

Program lines:

Description:

 





 

"!



 

"!



Checksum and length: 6157 004.5











It is easier to recall A than to remember where it is in the
stack.



.



Calculates

AB.



!



Replaces old A with new result.







Recalls constant for comparison.

º6¸@

Is

B

<

new A

?

!

Yes: loops to repeat subtraction.

#$



No:

displays

new

A.

!

Checksum and length: 5FE1 013.5

Loops With Counters (DSE, ISG)

When you want to execute a loop a specific number of times, use the

z

k

(increment; skip if greater than). or

{

m

(decrement; skip if less

than or equal to) conditional function keys. Each time a loop function is
executed in a program, it automatically decrements or increments a counter
value stored in a variable. It compares the current counter value to a final
counter value, then continues or exits the loop depending on the result.

For a count–down loop, use

{

m

variable

For a count–up loop, use

z

k

variable

These functions accomplish the same thing as a FOR–NEXT loop in BASIC:



variable = initial–value

!

final–value

!

increment

Advertising