# HP 48gII Advanced User's Reference Manual Page 45

Graphing calculator.

START takes two numbers (start and finish) from the stack and stores them as the starting and ending values of
the loop counter. Then the loop-clause is executed. STEP takes the increment value from the stack and
increments the counter by that value. If the argument of STEP is an algebraic or a name, it's automatically
evaluated to a number.
The increment value can be positive or negative. If it's positive, the loop is executed again if the counter is less
than or equal to finish. If the increment value is negative, the loop is executed if the counter is greater than or
equal to finish. Otherwise, execution resumes following STEP. In the previous flowchart, the increment value is
positive.
To enter START ... STEP in a program:
Press !° %BRCH% ... %START%.
!
Example:
The following program takes a number x from the stack and calculates the square of that number
several times (x/3 times):
« DUP  x « x 1 START x SQ -3 STEP " "
The FOR ... NEXT Structure
The syntax for this structure is
« ... start finish FOR counter loop-clause increment NEXT ... "
FOR ... NEXT executes the loop-clause program segment one time for each number in the range start to
finish, using local variable counter as the loop counter. You can use this variable in the loop-clause. The
loop-clause is always executed at least once.
Syntax
Start
finish
START
loop-clause
increment
STEP
START ... STEP Structure
Flowchart
1:Start
2:finish
counter=start
Store finish
Body of loop
1:increment
counter = counter +
increment
Is
yes
counter finish?
no
RPL Programming 1-19

49g+