Recently, I had a scenario where I wanted to execute a Logic App action times.  I wanted to achieve the equivalent of the following C# snippet:

for (int i = 0; i < 100; i++)
{
    //Perform action
}

Some research on the internet tells me that most folks solve this by using a Do-Until action, combined with Initialize Variable and Increment Variable.  Although this works fine, it requires quite some plumbing.  I thought: “there has to be an easier way” and yes… there is an easier way!

In order to loop 100 times, you can just use the foreach action and loop based on the following expression: range(1, 100).  The range function is explained over here.

For loop

Happy learning!
Toon

About me

Hi! I’m Toon Vanhoutte, a hands-on Azure architect – based in Belgium – with a big passion for teaching and helping people out. I’m happy to assist you during your Azure journey with high-quality advisory and I would love to teach you Azure’s possibilities via my tailored training courses.

Subscribe to the blog