Skip to main content

Loop through dictionary

Sophie avatar
Written by Sophie
Updated this week

Definition and Usage

Loop through each item in a dictionary. This command allows you to iterate through all key-value pairs in a dictionary data structure, processing each item individually within the loop.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Dictionary

Select a dictionary variable

Any dictionary variable

Yes

The dictionary must be defined before using this command

Variables produced

The action produces a variable to store each key-value pair during iteration. The output variable will contain the current dictionary item for each loop iteration.


Using Variables in Conditions

You can use variables in this command by clicking on the {x} icon next to the parameter fields. For example, you might use a previously defined dictionary variable as the input for the Dictionary parameter. The output variable can be used in subsequent actions within the loop to access the current key-value pair.


Notes

  • The loop will execute once for each key-value pair in the dictionary

  • The output variable represents the current key-value pair in each iteration

  • You can access both the key and value of the current item within the loop

  • Empty dictionaries will not execute the loop body

  • Any actions placed between this Loop command and its corresponding End Loop command will be executed for each item in the dictionary

  • This command is useful for processing collections of related data stored as key-value pairs

Did this answer your question?