HP 48gII Advanced User's Reference Manual page 48

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

« ... DO loop-clause UNTIL test-clause END ... »
DO... UNTIL... END executes the loop-clause sequence repeatedly until test-clause returns a true (nonzero)
result. Because the test-clause is executed after the loop-clause, the loop-clause is always executed at least once.
DO starts execution of the loop-clause. UNTIL marks the end of the loop-clause. The test-clause leaves a test
result on the stack. END removes the test result from the stack. If its value is zero, the loop-clause is executed
again — otherwise, execution resumes following END. If the argument of END is an algebraic or a name, it's
automatically evaluated to a number.
To enter DO ... UNTIL ... END in a program:
Press !°%BRCH% ! %DO%.
!
Example:
The following program calculates n + 2n +3n + ... for a value of n. The program stops when the
sum exceeds 1000, and returns the sum and the coefficient of n.
Program:
«
DUP 1
 n s c
1-22 RPL Programming
Syntax
DO
loop-clause
UNTIL
test-clause
END
DO ... UNTIL ... END Structure
Comments:
Duplicates n, stores the value into
n and s, and initializes c to 1.
Flowchart
Body of loop
TEST
1: test result
Is test
no
result non-zero?
yes

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents