To execute some actions or block of statements repeatedly we use Loops. In most of the cases using If and Switch Case conditions for doing complex repetitive tasks won't be efficient. In Power Automate Dekstop, we can design flows with the help of loops to simplify some complex tasks.
Power Automate Desktop provides different kinds of loops that work on various factors:
For example, if we want to print odd numbers from 1 to 100 we can create a loop where i=1, loop will keep executing unit the condition i<100 is true and it will increment it by 2. It will print all odd numbers from 1 to 100 as output.
The idea behind the loop is to make the desktop flow repeat one or more actions over and over again. Power Automate Desktop uses a simple type of loops for Loop action.
This loop repeats the actions between Loop and End actions the specified number of times. Loop index variation is automatically adjusted to track the current iteration number.
The simple loop is ready for use in two situations:





The Loop condition makes a desktop flow execute one or more actions as long as a condition is satisfied. If the condition is always satisfied, the loop will never stop. This situation is called an endless loop.
The condition action consists of two operands and an operator. It supports some logical operations, such as equal, not equal, and greater than.
In case you need to exit the loop before the specified loop is completed, use the Exit loop action. To skip the current iteration, use the Next loop action.









For Each loop runs in a list and keeps the current item flexible. Its main purpose is to find each item in the list (or the data table row) and use it in other actions.
You can use this type of loop to search for specific words, content, or attributes in all list types. For example, you can narrow down a list of extracted files to find a file with a specific name.






The difference between Simple loops and For Each loop is that in Simple loops we need to initialize the value, the end value needs to be specified and we need to increment the value. Whereas in For Each we will traverse through all the values without initializing or incrementing them.
I am Sharvari Raut, having sound knowledge and experience in technical writing. Currently, pursuing my B.Tech in Computer Science and Engineering.