Reference Guide

1-18 RPL Programming
The START  NEXT Structure
The syntax for this structure is
«
start finish
START
loop-clause
NEXT
»
START … NEXT executes the loop-clause sequence of commands one time for each number in the range start to
finish. The loop-clause is always executed at least once.
Syntax Flowchart
Start
finish
START
loop-clause
NEXT
1:Start
2:finish
counter=start
Store finish
Body of loop
counter = counter + 1
Is
counter finish?
yes
no
START  NEXT Structure
START takes two numbers (start and finish) from the stack and stores them as the starting and ending values for a
loop counter. Then, the loop-clause is executed. NEXT increments the counter by 1 and tests to see if its value is
less than or equal to finish. If so, the loop-clause is executed again — otherwise, execution resumes following
NEXT.
To enter START  NEXT in a program:
Press
%BRCH%
!%START%
.
Example:
The following program creates a list containing 10 copies of the string
"ABC"
:
«
1 10 START "ABC" NEXT 10 →LIST
»