HP 48gII Advanced User's Reference Manual page 49

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

Advertisement

Program:
«
DO
'c' INCR
n * 's' STO+
UNTIL
s 1000 >
END
s c
»
»
The WHILE ... REPEAT ... END Structure
The syntax for this structure is
« ... WHILE test-clause REPEAT loop-clause END ... »
WHILE ... REPEAT ... END repeatedly evaluates test-clause and executes the loop-clause sequence if the test
is true. Because the test-clause is executed before the loop-clause, the loop-clause is not executed if the test is
initially false.
WHILE starts execution of the test-clause, which returns a test result to the stack. REPEAT takes the value from
the stack. If the value is nonzero, execution continues with the loop-clause-otherwise, execution resumes
following END. If the argument of REPEAT is an algebraic or a name, it's automatically evaluated to a number.
Comments:
Starts the defining procedure.
Starts the loop-clause.
Increments the counter by 1. (See
Using Loop
Calculates c × n and adds the product to s.
Starts the test-clause.
Repeats loop until s > 1000.
Ends the test-clause.
Puts s and c on the stack.
Ends the defining procedure.
Syntax
WHILE
test-clause
REPEAT
loop-clause
END
WHILE ... REPEAT ... END Structure
ounters.)
C
Flowchart
TEST
1: test result
Is test
result non-zero?
no
yes
Body of loop
RPL Programming 1-23

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents