Skip to main content

Loop by count

Sophie avatar
Written by Sophie
Updated this week

Definition and Usage

This command repeats a set of commands for a defined number of times. It allows you to create loops that execute a sequence of actions repeatedly based on a specified count, with options to customize the starting index and increment value.


Parameter Values

Input parameters

Parameter Name

Description

Possible Values

Required

Options / Notes

Loop count

Specify the number of times the loop will repeat execution

Integer value

Yes

Must be a positive integer

Save loop index as

Store the loop index in a new variable

Variable name

No

This variable can be used within the loop to track the current iteration

Advanced settings

Parameter Name

Description

Possible Values

Required

Options / Notes

Start from

Specify the index to start with

Integer value

No

Default is 1 if not specified

Increment by

Set the step size between loop iterations

Integer value

No

Default is 1 if not specified

Variables produced

The command produces a variable that stores the current loop index, as specified in the "Save loop index as" parameter. This variable is updated on each iteration of the loop.


Using Variables in Conditions

You can use variables in the Loop count, Start from, and Increment by parameters by clicking the {x} icon. This allows you to dynamically set these values based on previously defined variables. For example:

  • Use a variable to set the number of iterations based on data retrieved earlier in the workflow

  • Use variables to create dynamic starting points or increment values


Notes

  • The loop index starts from the value specified in "Start from" (default: 1) and increases by the value in "Increment by" (default: 1) with each iteration

  • The loop will execute exactly the number of times specified in "Loop count"

  • All commands placed inside the loop block will be executed during each iteration

  • To exit a loop prematurely, you can use a conditional Break command inside the loop

  • For processing collections of data, consider using "Loop through list" or "Loop through table" instead of this command

Did this answer your question?