$WBFOR - unconditional (for...next) loop

$WBFOR is available for use with all WBSP commands.


VarName - the name of the variable used as a loop counter. The variable can be accessed using $WBGETV function (see the example)
Start - initial value of loop counter.
End - final value of loop counter.
Step - optional parameter - amount counter is changed each time through the loop. It can be either positive (when start < end) or negative (when start > end). If not specified, step defaults to 1 (one).
Content - block of code (including WhizBase elements) that will be repeated through the loop

Code contained in content repeated through the loop.


$WBFOR[LCnt|20|2|-2|Counter value: $wbgetv[LCnt]<br>]

After running this example, the resulting page in browser, should look like this:

Counter value: 20
Counter value: 18
Counter value: 16
Counter value: 14
Counter value: 12
Counter value: 10
Counter value: 8
Counter value: 6
Counter value: 4
Counter value: 2