# For Each Loop / For Each Loop With Break Not Working

**URL:** <https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [March 4, 2016, 6:59pm UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274 "2016-03-04T18:59:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_673abc19](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_673abc19](https://forums.unrealengine.com/u/anonymous_user_673abc19)\
**Post date:** [March 4, 2016, 6:59pm UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274/1 "2016-03-04T18:59:41Z")

</div>

![Sem título.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/8/184bd6ded9d4ce44cb521b9bf9828c19a1f22c6e.png)  
As you can see in the image, the exec stops in the node for each loop.

---

<div class="post-metadata">

**Author:** ![JmDevTx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JmDevTx](https://forums.unrealengine.com/u/JmDevTx)\
**Post date:** [March 5, 2016, 3:15am UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274/2 "2016-03-05T03:15:11Z")

</div>

If your array is empty, then it is working fine. Otherwise, have you modified the Macro?

---

<div class="post-metadata">

**Author:** ![StarfireDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StarfireDev](https://forums.unrealengine.com/u/StarfireDev)\
**Post date:** [March 5, 2016, 9:27pm UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274/3 "2016-03-05T21:27:20Z")

</div>

Print the [array’s length](https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Arrays/ArrayNodes/index.html) to see if it has data before entering the Loop

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8147ab75](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8147ab75](https://forums.unrealengine.com/u/anonymous_user_8147ab75)\
**Post date:** [March 5, 2016, 9:51pm UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274/4 "2016-03-05T21:51:16Z")

</div>

Do you have a Delay anywhere in your loop? I find the BP loop functions to be dysfunctional and there are so many things that seem to “break” them that I just make my own loops now.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_673abc19](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_673abc19](https://forums.unrealengine.com/u/anonymous_user_673abc19)\
**Post date:** [March 7, 2016, 3:27pm UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274/5 "2016-03-07T15:27:55Z")

</div>

> [@Mbublitz;487573](#):
>
> Do you have a Delay anywhere in your loop? I find the BP loop functions to be dysfunctional and there are so many things that seem to “break” them that I just make my own loops now.

> [@Gbr;487564](#):
>
> Print the [array’s length](https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Arrays/ArrayNodes/index.html) to see if it has data before entering the Loop

> [@Jamendxman3;487177](#):
>
> If your array is empty, then it is working fine. Otherwise, have you modified the Macro?

Thanks guys , fixed , i need the empty array at the start , all i have to do is Resize the array in ‘Begin Play’. Very strange, because i have another array and i did not have to do this

---

<div class="post-metadata">

**Author:** ![StarfireDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StarfireDev](https://forums.unrealengine.com/u/StarfireDev)\
**Post date:** [March 9, 2016, 2:06pm UTC](https://forums.unrealengine.com/t/for-each-loop-for-each-loop-with-break-not-working/57274/6 "2016-03-09T14:06:52Z")

</div>

Nice! Congratulations.
