4.18 WHILE...BREAK...CONTINUE...ENDWHILE

Requires a conditional expression. If the conditional expression evaluates to true, the section of the template is processed. When the ENDWHILE is encountered, the expression is evaluated again. The section of the template is processed repeatedly until the expression evaluates to false.

If a BREAK keyword is encountered before the ENDWHILE, processing is discontinued until immediately after the ENDWHILE keyword.

If a CONTINUE keyword is encountered, processing moves back to the WHILE keyword for re-evaluation. Anything between the CONTINUE and ENDWHILE keywords are not processed.

{SET maxLines=10}
{SET i = 0}
{WHILE i < Folder.count}
{IF i > maxLines}
{BREAK}
{ENDIF}
{IF Folder[i].type == "FOLDER-TYPE-CALENDAR"}
{INC i}
{CONTINUE} {! Skip the calendar folder }
{ENDIF}
{VAR Folder[i].name}<BR>
{INC i}
{ENDWHILE}