| Format: <while Expression> heitml </while> |
Purpose: The while tag is used to program a loop.
First, the Expression is evaluated. The result must be of type Boolean. While the expression evaluates to true, the actions defined in the body of the loop are executed.
An alternative to the while loop is the for loop.
| Caution! Before running a program that uses while loops, first check that you did not program an endless loop. |
Example:
| resulting output: | |
<let i = 0; while i ≤ 10; ? i * 2; if i < 10>,</if; i = i + 1; /while> | 0,2,4,6,8,10,12,14,16,18,20 |
| Note: The while Tag is Case Sensitive, which means that heitml will not recognize it if you use capital letters (e.g. <WHILE Expression>). |