You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
78 CHAPTER 3. LANGUAGE<br />
Ð× Another simple control structure is the condition with alternative. If the condition is<br />
true, all expressions and calls between the head and the word Ò are performed. If the<br />
condition is false the part between Ð× and Ò is executed. Note that the operator is<br />
called Ð× and it is displayed as in the program text area.<br />
´ÓÒØÓÒµ<br />
ººº<br />
Ð×<br />
ººº<br />
Ò<br />
ÛÐ The ÛÐ loop has a boolean expression as the conditional part. As long as it is ØÖÙ,<br />
the body of the loop is performed. In order to enter the loop, the condition has to be true<br />
in the first place.<br />
ÛÐ ´ÓÒØÓÒµ<br />
ººº<br />
ÒÛÐ<br />
In chapter 5.3 you can find an example for using the ÛÐ loop.<br />
ÓÖ The ÓÖ loop is controlled by a start and termination value and an incrementation value<br />
that determines the number of loop steps. These values may also be expressions which<br />
are evaluated immediately before the loop is entered. The expressions may be of type<br />
ÒØÖ or of type ÖÐ. If all input values are of type ÒØÖ the loop variable will<br />
also be of type ÒØÖ. In all other cases the loop variable will be of type ÖÐ.<br />
If the start value is less or equal to the termination value, the starting value is assigned to<br />
the loop index and the body of the loop is entered. If the increment is less than zero the<br />
loop is entered if the start value is larger or equal to the end value. Each time the body is<br />
executed, the loop index is incremented by the incrementation value. If the loop index is<br />
equal to the termination value, the body of the loop is performed for the last time. If the<br />
loop index is larger than the termination value the body will not be excecuted any longer. 3<br />
Please note, that the loop index does not need to become equal to the termination value<br />
in order terminate the loop. The loop index is set to the termination value when the loop<br />
is being left.<br />
Please note, that the expressions for start and termination value are evaluated only once<br />
when entering the loop. A modification of a variable that appears within these expressions<br />
has no influence on the termination of the loop. The same applies to the modifications<br />
of the loop index. It also has no influence on the termination. The loop value is assigned<br />
to the correct value each time the ÓÖ operator is executed. For more details, see<br />
section 4.4.2 on the code generation of ÓÖ loops.<br />
If the ÓÖ loop is left too early (e.g., if you press ËØÓÔ and set the È) and the loop is<br />
entered again, the expressions will be evaluated, as if the loop were entered for the first<br />
time.<br />
ÓÖ ÐÓÓÔ ÚÐÙ ËØÖØ ØÓ Ò Ý ÁÒÖÑÒØ<br />
ººº<br />
ÒÓÖ<br />
3 For negative increment values the loop is terminated if the loop index is less than the termination value.<br />
<strong>HDevelop</strong> / 2000-11-16