Changes
While
,Created page with "Used in combination with Begin and End to form a conditional loop statement that will execute a set of instructions repeatedly as long as a logical expression is true...."
Used in combination with [[Begin]] and [[End]] to form a conditional loop statement that will execute a set of instructions repeatedly as long as a logical expression is true. If the logical expression is not true, the instructions will not be executed.
[[Begin]] and [[End]] statements are used to group instructions for conditional execution; a [[Begin]] must always be followed by an [[End.]]
[[Begin]] should not be followed by a semicolon (;), code lines within an instruction group should end with a semicolon (;), and [[End]] should be followed by a semicolon (;).
==== Usage ====
<syntaxhighlight>While E Begin
I1;
I2;
I3;
End;</syntaxhighlight>
Where: [[E]] - a true/false expression
[[I]] - conditional instructions
==== Example ====
Add the high prices of the last 10 bars to the [[HighPriceSum]] variable:
<syntaxhighlight>BarBackNo=0;
While BarBackNo<10 Begin
HighPriceSum=HighPriceSum+High[BarBackNo];
BarBackNo=BarBackNo+1;
End;</syntaxhighlight>
[[Category:Comparisons and Loops]]
[[Begin]] and [[End]] statements are used to group instructions for conditional execution; a [[Begin]] must always be followed by an [[End.]]
[[Begin]] should not be followed by a semicolon (;), code lines within an instruction group should end with a semicolon (;), and [[End]] should be followed by a semicolon (;).
==== Usage ====
<syntaxhighlight>While E Begin
I1;
I2;
I3;
End;</syntaxhighlight>
Where: [[E]] - a true/false expression
[[I]] - conditional instructions
==== Example ====
Add the high prices of the last 10 bars to the [[HighPriceSum]] variable:
<syntaxhighlight>BarBackNo=0;
While BarBackNo<10 Begin
HighPriceSum=HighPriceSum+High[BarBackNo];
BarBackNo=BarBackNo+1;
End;</syntaxhighlight>
[[Category:Comparisons and Loops]]