A for expression is particularly well-suited to looping situations in which unconditional repetition is needed. Conversely, situations in which conditional repetition is needed are often best dealt with using a while expression.
In the upto variant, the value of the loop variable will iterate from the start expression to the end expression in step expression increments. If you omit the step expression, the step increment defaults to 1.
In the downto variant, the value of the loop variable iterates from the start expression to the end expression in step expression decrements. If the step expression is omitted, the step decrements defaults to -1.
Iterations of the loop are controlled by the end expression value. Before each iteration, the end expression is evaluated and compared to the loop variable. If the result is true (1), the expression list is evaluated. After each evaluation, the step expression is evaluated and added to the loop variable.
Before each iteration, the end expression is evaluated and compared to the loop variable. In addition, after each evaluation of the do condition, the step expression is evaluated and added to the loop variable.
A for loop terminates when the start expression has surpassed the end expression. The start expression can surpass the end expression in either an upwards direction, if you use upto, or in a downward direction, if you use downto.
for variable = start expression
(upto | downto ) end expression
(step step expression ) do
expression list
Note:
The result of the list of expressions associated with the do condition.
var List = ref(xfa.record.lists.list1)
for i=0 upto List.nodes.length – 1 step 2 do
$.addItem (List.nodes.item(i).value,”")
endfor

For expressions