Anonymous user
Loops/Wrong ranges: Difference between revisions
m
→{{header|REXX}}: added verbiage to the REXX section header, corrected a misspelling.
m (→{{header|Python}}: Tidy.) |
m (→{{header|REXX}}: added verbiage to the REXX section header, corrected a misspelling.) |
||
Line 453:
=={{header|REXX}}==
Note that a '''do''' loop with zero '''by''' value, or a '''do''' loop that goes in the "wrong" direction is not considered an error in REXX as there are other methods of limiting the range (or stopping condition) within the loop body. A special check was made in this REXX version to check for a runaway (race) condition.
<lang rexx>/*REXX program demonstrates several versions of DO loops with "unusual" interations. */▼
The REXX language will cause the '''do''' loop index to be checked at the "head" of the '''do''' loop to see if the index falls within the specified iteration range (if there is one).
▲<lang rexx>/*REXX program demonstrates several versions of DO loops with "unusual"
@.=; @.1= ' -2 2 1 ' /*"normal". */
@.2= ' -2 2 0 ' /*"normal", zero increment.*/
|