OTX Reference  
OpenTestSystem.Otx.Core.Nodes.Node.CompoundNode.Loop.LoopRealisation.LoopConfigurationHeader.LoopConfigurationRealisation.ForLoop Class Reference

Loop with a counter More...

Inheritance diagram for OpenTestSystem.Otx.Core.Nodes.Node.CompoundNode.Loop.LoopRealisation.LoopConfigurationHeader.LoopConfigurationRealisation.ForLoop:
Inheritance graph

Public Attributes

IntegerVariable counter
 Loop counter, which is bound to a variable of type Integer. More...
 
NumericTerm end
 End value of the counter. If the End value has been reached the loop terminates. More...
 
NumericTerm start
 Start value for the counter. More...
 

Detailed Description

Loop with a counter

The for-loop allows configuring a start and an end value of type Integer. When the loop starts, the start value is assigned to the counter (Integer). Prior to each iteration, the counter value is compared to the end value. If the counter value exceeds the end value, the loop exits, otherwise the iteration is carried out. After each iteration – also after the final one – the counter is incremented by one. The counter value can be accessed and be used for any kind of computation in the loop flow.

Note
Since a counter variable is visible procedure-wide, it is accessible on the outside of the loop as well.
When entering a for-loop, the old counter value will be overwritten implicitly by the start value. After finishing the final iteration normally (not by break), the counter value will be incremented one more time. This value is the exit value visible to the follower nodes of the loop node.
By contrast to the for-each-loop behaviour which throws a ConcurrentModificationException if its collection is changed during loop execution, it is valid to change a for-loop's counter value while the for-loop is active.
Loop iterations can be terminated prematurely using Break or Continue.
The counter variable shall be increased by 1 at the end of each loop iteration even if terminated by a Continue node. Only in the case that a loop iteration is terminated by a Break node, the counter variable shall not be increased before leaving the loop.
Syntax
for (IntegerVariable counter, NumericTerm start; NumericTerm end) : LoopName
{
...
}
NumericTerm end
End value of the counter. If the End value has been reached the loop terminates.
Definition: Core.cs:5470
IntegerVariable counter
Loop counter, which is bound to a variable of type Integer.
Definition: Core.cs:5450
Example
// Local Declarations
Integer Integer1;
// Flow
for (Integer1; 0; 9) : ForLoop1
{
Hmi.ConfirmDialog(Conversion.ToString(Integer1), null, @MessageTypes:INFO, null);
}

Member Data Documentation

◆ counter

IntegerVariable OpenTestSystem.Otx.Core.Nodes.Node.CompoundNode.Loop.LoopRealisation.LoopConfigurationHeader.LoopConfigurationRealisation.ForLoop.counter

Loop counter, which is bound to a variable of type Integer.

◆ end

NumericTerm OpenTestSystem.Otx.Core.Nodes.Node.CompoundNode.Loop.LoopRealisation.LoopConfigurationHeader.LoopConfigurationRealisation.ForLoop.end

End value of the counter. If the End value has been reached the loop terminates.

◆ start

NumericTerm OpenTestSystem.Otx.Core.Nodes.Node.CompoundNode.Loop.LoopRealisation.LoopConfigurationHeader.LoopConfigurationRealisation.ForLoop.start

Start value for the counter.