Loop Structures

ViviFire's loop structures allow you to repeatedly execute a set of statements. You can repeat statements while a condition is true, until a condition becomes false, a specified number of times, or once per element in a collection.

While loops

The While construction executes a block of statements as long as the condition specified in the While clause is true. For more information, see While Statement.

Do loops

The Do...Loop construction is similar to While but with greater flexibility. You can test the condition either at the beginning or the end and you specify whether the loop executes while the condition is true or until it becomes true. For more information, see Do...Loop Statement.

For loops

The For...To construction executes a block of statements a fixed number of iterations. It steps through a range of values assigning a variable, called the counter, a different value for each iteration. You can optionally specify the step size, which has a default of 1. For more information, see For...To Statement.

For Each loops

The For Each...In construction executes a block of statements once for each element in a collection. It is best used where you can safely disregard factors such as the size and order of the collection. For more information, see For Each...In Statement.

Begin...When clauses

For most loop structures, ViviFire supports statements that appear inside the loop but are executed outside of it. The When %DONE clause is executed only if the body of the loop in which it appears executed fully and exited normally. The When %NONE clause is executed only if the body of the loop was never entered. For more information, see Begin...When Statements.

See also