Category
Function
Iterates through the specified set of integers.
Syntax
current, last = ForEachN(start, end, delta);
Inputs
Name | Type | Default | Description |
---|---|---|---|
start | integer | none | value of the first integer through the loop |
end | integer | none | value of the last integer through the loop |
delta | integer | 1 | numerical interval between successive integers output by the loop |
Outputs
Name | Type | Description |
---|---|---|
current | integer | the current integer |
last | flag | status of loop |
Functional Details
This module initiates an iteration for each integer in the set unless execution is terminated earlier by Done. Its function is similar to that of a "for" in standard programming languages. In the user interface, this module would usually be part of a macro, and only the contents of the macro would be executed for each iteration of the loop. If this module is placed in the top level visual program, the entire program will be executed during the loop.
Typically, loops are initiated with ForEachMember or ForEachN, although they can also be implemented with a Get/Set pair and Done.
Note: If this module is used in the scripting language, the results are defined only if they are used inside a macro.
start
is the value of the first integer of the loop
end
is the value of the last integer of the loop
delta
is the interval between successive integers of the loop
This module has two outputs:
current | is the value of the integer currently being iterated. |
last | is a flag indicating whether or not this is the last iteration through the loop. |
Example Macro and Program
FactorialMacro.net Factorial.net
See Also
Done, First, ForEachMember, GetGlobal, GetLocal, SetGlobal, SetLocal
Chapter 4. "Data Explorer Execution Model" in IBM Visualization Data Explorer User's Guide.
[Data Explorer Home Page | Contact Data Explorer | Same document on Data Explorer Home Page ]