
• START (start, end') code NEXT
Runs code, increments start. Repeats imtil start > end. The code is
always nm at least once.
® START {start, end) code STEP (incr)
Runs code, increments stmt by the number specified by incr. {incr can
be an expression.) Repeats imtil start > end. The code is always rim at
least once.
• FOR {var, start, end) code NEXT
Rims code, sets var to start. Increments var, and repeats until var >
end. This is similar to START... NEXT except that you can use var in
your code.
• FOR {var, start, end) code STEP finer)
Runs code, increments var by the niuuber specified by inrr. {incr can
be an expression.) Repeats imtil start > end. This is similar to START
... STEP except that you can use var in your code.
• DO code UNTIL comparison END
Rims code, then tests to see if comparison evaluates to true. Ends if it
does. Repeats code if it does not. The code is always ran at least once.
• WHILE comparison REPEAT code END
Checks if comparison evaluates to true. Runs code if it does. Repeats
until test returns false. This is similar to DO ... UNTIL except that code
is not nm if comparison evaluates to false the first time.
Example
The following example processes a list of muneric values that is stored in
a variable named MARKS. It performs the following:
• It determines the number of elements in the list.
• For each element in the list, the program compares tire element to the
pass value:
a. If the element is greater than or equal to the pass value, inserts
“Pass” after the value.
b. If the element is less than the pass mark, inserts “Fail” after the
value. Note that this converts the value to a string.
« It replaces the original value with the string.
Page 10-14 Introduction to programming
Commentaires sur ces manuels