Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
manual:chapter5:basics [2021/09/15 10:24] claudio |
manual:chapter5:basics [2021/09/15 10:32] (current) claudio |
||
---|---|---|---|
Line 423: | Line 423: | ||
* '' | * '' | ||
- | Notice that despite the starting value being higher than the end value and the loop using '' | + | Notice that despite the starting value being higher than the end value and the loop using '' |
Now let's review a loop using '' | Now let's review a loop using '' | ||
Line 437: | Line 437: | ||
* '' | * '' | ||
- | Notice that while the loop appears to count up by looking at the code, the condition A>10 causes the loop to be counting down because the start value is larger than the end value, and therefore it will only end when J<10, regardless of the magnitude and direction of the step. | + | Notice that while the loop appears to count up by looking at the code, the condition A>10 causes the loop to be counting down because the start value is larger than the end value, and therefore it will only end when J<10, regardless of the magnitude and direction of the step. Since the step increases the counter, the loop never ends. |
- | In situations | + | In some situations it is desirable to keep the direction of the loop fixed regardless of the start/end values. The '' |
* The direction of the loop is fixed and known, regardless of the values the limits might have at run time. | * The direction of the loop is fixed and known, regardless of the values the limits might have at run time. | ||
* The loop has one additional check when the word '' | * The loop has one additional check when the word '' | ||
- | Back to the example used above for '' | + | Back to the example used above for '' |
< | < |