EasyManua.ls Logo

HP 48GII

HP 48GII
653 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1-22 RPL Programming
! «!!!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.
Syntax Flowchart
UNTIL
END
Body of loop
TEST
Is test
result non-zero?
no
yes
1: test result
test-clause
DO
loop-clause
DO … UNTIL … END Structure
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: Comments:
"!
452!3!
#!G!Z!&
Duplicates n, stores the value into
n and s, and initializes c to 1.

Table of Contents

Other manuals for HP 48GII

Related product manuals