{for <number> to <number> as $itemVar [ sequence <array> as $seqVar ]} [ {delimiter}...{/delimiter}] [ {break} ] [ {continue} ] [ {skip} ] {/for}
This mechanism makes it possible to do generic looping. It supports looping over numerical ranges in both directions. In addition it also supports breaking, continual and skipping.
{for 0 to 7 as $counter} Value of counter: {$counter} <br /> {/for}
The following output will be produced:
Value of counter: 0
Value of counter: 1
Value of counter: 2
Value of counter: 3
Value of counter: 4
Value of counter: 5
Value of counter: 6
Value of counter: 7