Commands involved in the START construct are available through:
Within the BRCH menu („°@) @ BRCH@) the following keystrokes are available
to generate START constructs (the symbol indicates cursor position):
„ @START: Starts the START...NEXT construct: START
‚ @START: Starts the START...STEP construct: START
The START...NEXT construct
The general form of this statement is:
start_value end_value START program_statements NEXT
Because for this case the increment is 1, in order for the loop to end you should
ensure that start_value < end_value. Otherwise you will produce what
is called an infinite (never-ending) loop.
Example – calculating of the summation S defined above
The START...NEXT construct contains an index whose value is inaccessible to
the user. Since for the calculation of the sum the index itself (k, in this case) is
needed, we must create our own index, k, that we will increment within the loop
each time the loop is executed. A possible implementation for the calculation of
S is the program:
n S k
NEXT S "S"
Type the program in, and save it in a variable called @@@S1@@@.
Here is a brief explanation of how the program works:
„°@) @ BRCH@ @) S TART @START
0. n START k SQ S + 1. 'k' STO+ 'S' STO
TAG " "