-
Notifications
You must be signed in to change notification settings - Fork 24
For
Miriam McMahon edited this page Apr 27, 2023
·
10 revisions
A logic component that will execute a block of commands in a loop until a condition is met.
Parameter Name | Description | Type | Resolved Type | Required |
---|---|---|---|---|
Before | An inline expression to execute that will initialize the counter. The %{}% marker is not needed because this must be an expression | Value | Expression | No |
Condition | An inline expression to evaluate. If it evaluates to true, continue the loop. If false, end the loop. The %{}% marker is not needed because this must be an expression | Value | Boolean | No |
End | An inline expression to execute at the end of the block, to increment the counter. The %{}% marker is not needed because this must be an expression. increment or decrement part | Value | Expression | No |
Body | The block of commands to be executed in the loop | Do Block | n/a | Yes |
MaxIterations | The maximum iterations of the loop. Added in Safeguard v7.2 | Value | Integer | No |
(Note: The counting variable, 'counter', must exist prior to the for loop. In this example, 'counter' it is being created by the SetItem)
{
"SetItem": {
"Name": "counter",
"Value": 0
}
},
{
"For": {
"Before": "counter = 0",
"Condition": "counter < 20",
"End": "counter = counter + 1",
"Body": {
"Do": [
{
"Log": {
"Text": "Looping: counter = %{ counter }% "
}
}
]
}
}
}