The START NEXT Structure

The syntax for this structure is

«start finish START loopclause NEXT »

START … NEXT executes the loopclause sequence of c ommands one time for each number in the range start to finish. The loopclause is always executed at least once.

Syntax

Flowchart

 

Start

1:Start

 

finish

2:finish

 

START

counter=start

 

 

Store finish

 

loop-clause

Body of loop

 

 

counter = counter + 1

 

NEXT

 

 

 

Is

yes

 

counter finish?

 

 

 

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 loopclause is executed. NE XT increments the counter by 1 and tests to see if its value is less than or equal to finish. If so, the loopclaus e 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 »

118 RPL Programming

Page 42
Image 42
HP 50g Graphing manual Start Next Structure, « … start finish Start loopclause Next … », To enter Start Next in a program