XenoGuard Documentation

For Loop

Actions » Programming » Flow Control » For Loop 

The action For Loop executes one or more actions a specified number of times. The number of repetitions is calculated from the Start value, the End value, and an increment value named Step, which is 1 by default. In addition, it is possible to select which operation is used to compare the Start value and the End value.

[-] Hide
  1. Open the Programming node in the Workspace Explorer.
  2. In the Flow Control node, select the For Loop action.

Parameters:

The action has the following input parameters:


name Description
Identifier The identifier to be iterated. The input is optional.

Allowed Context Scopes
[Local, Global]
Allowed Context Types [Variable, Parameter, Result]
Start
The starting value of the loop.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Result, Enum]
Comparison
The type of operator to be used to compare the Start and End values.

Allowed Context Scope
 [Fixed]
Allowed Values [Less than (<), Less than or equal to(<=), Greater than (>), Greater than or equal to (>=)] 
End
The end value of the loop.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Result, Enum] 
Step The increment by which the loop counter is increased.

Allowed Context Scopes
 [Fixed, Local, Global, Enum]

Results:

The action returns the following results:

name
description
Number of Loops

Contains the total number of loops executed


Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Result]

Example 1 (Display the iterated contents of a variable):

This example increments the content from the local variable numValue with Number as data type. The value of the variable is then checked if it meets the specified condition and Result is then output via Message Box.


Example 2 (Display the content of a list in a message box):

This example gets the value from the local list named Tests and iterates the contents using the For Loop as long as it is within the specified list count. Each Value of the list is then output via Message Box.

See other flow control actions:

If
For Each
While
Break
Label
GoTo
Parallel
On Error Continue
On Error GoTo
Abort
Abort on Error