- ⌂ Flow Control
- Directives
#WHILE
Execute and repeat a block of cTemplate if a condition as long as the condition is true at the before it is executed each iteration.
Prototype
#WHILE(condition) ... #ENDWHILE
Parameters
- condition - A cTemplate expression and/or cScript expression that determines if the block should executed (TRUE) or terminate (FALSE)
Example
#ASSIGN($i, 1)
#WHILE($i<=3)
Iteration $i<br/>
#ASSIGN($i, $i+1)
#ENDWHILE
Result
Iteration 1
Iteration 2
Iteration 3