# How to create a Loop?

**URL:** https://community.homey.app/t/how-to-create-a-loop/97938
**Category:** Flows
**Tags:** flow
**Created:** [December 15, 2023, 10:15am UTC](https://community.homey.app/t/how-to-create-a-loop/97938 "2023-12-15T10:15:02Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![DirkH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkh/32/78952_2.png) [@DirkH](https://community.homey.app/u/DirkH)
#### Post date: [December 15, 2023, 7:01pm UTC](https://community.homey.app/t/how-to-create-a-loop/97938/4 "2023-12-15T19:01:26Z")

</div>

I ran a test and recursive flows work. Unfortunately a flow cannot invoke itself. But you can create two flows, which invoke each other. And there is a strict limit of a bit more than 100 recursions. In my example 116 worked, 117 stopped.  
Start-flow to initiate global variables and then run the main recursive flow with the start value:

 ![TestAddNumbersToX](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/5/257b73827682bb8592953ae779e2437f7a9a71ec.jpeg)  
Here is the main recursive flow for the sum:  
 ![TestRecursiveSum](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/7/2782ab8ec6ac800f9c0d5232146cb45c01116fb9.jpeg)  
As it cannot refer to itself it refers to an old test flow that I changed. I does not anything but referring back to the main recursive flow with the same tag.  
 ![Test mit Tag](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/9/69f3166e685578f1ea94fe87d033e270decc6d4a.jpeg)  
There are better methods to add the numbers from 1 to X, but it is a good example how it works. You just have to use it carefully.

---

_[View the full topic](https://community.homey.app/t/how-to-create-a-loop/97938)._
