BEE Script: while [maxiter=num] (condition) statement;
or while [maxiter=num] (condition)
{ statement; ... }
BEE Tag: <beewhile "condition" [maxiter=num]>
tag
...
</beewhile>
Note: The condition is surrounded by a small bracket and therefore is taken literally. While you can (and sometimes need to) quote individual values in the condition, please do not quota the whole condition with double or single quote. Otherwise, the whole condition will be taken as a string (and will most likely to be evaluated to true unless it is blank or 0).
The "while" loop iterates for as long as the condition evaluates to true.
Please note that variables in condition are evaluated as macros and therefore one should bear in mind the logical expression syntax. In particular, you need to quote strings as required. Please see the "if" command for examples.
Example:
var i = 0;
while ({i} < 5)
{
display 'i=<br>\n';
var i = "(expr){i} + 1";
}
// Sample display:
// i=0
// i=1
// i=2
// i=3
// i=4
Parameters
maxiter is the maximum number of iterations the loop will execute. It is default to 1000. Zero means infinity.
The following BEE Variables will be made available within a "while" loop:
result%while:istrue |
Set to 1 if the condition evaluates to true, or 0 otherwise |
result%while:condition |
Set to the condition after variable evaluation |
result%while:iteration |
The iteration count. It contains 1 in the first iteration and 2 for the second etc. |
An interesting remark on the "while" command: The condition is declared once but evaluated multiple times, each in every iteration. Internally the condition is passed in through an implicit "absolute" attribute, which means no pre-evaluation will be done until the execution starts.
|