# Using collapse to function breaks when used with loops

**URL:** <https://forums.unrealengine.com/t/using-collapse-to-function-breaks-when-used-with-loops/338677>\
**Category:** Blueprint\
**Tags:** unreal-engine, bug-report, editor, feedback, UE4, question, Blueprint\
**Created:** [November 16, 2015, 5:40pm UTC](https://forums.unrealengine.com/t/using-collapse-to-function-breaks-when-used-with-loops/338677 "2015-11-16T17:40:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dzarafata](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dzarafata](https://forums.unrealengine.com/u/dzarafata)\
**Post date:** [November 16, 2015, 5:40pm UTC](https://forums.unrealengine.com/t/using-collapse-to-function-breaks-when-used-with-loops/338677/1 "2015-11-16T17:40:00Z")

</div>

When using “collapse to function” tool in blueprint on code with loop, editor adds return node to the `loop body` execution path which makes loop to end afret first iteration. In my opinion, return node should be linked only to `completed`, so function will end after executing whole loop.

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [November 16, 2015, 7:40pm UTC](https://forums.unrealengine.com/t/using-collapse-to-function-breaks-when-used-with-loops/338677/2 "2015-11-16T19:40:41Z")

</div>

Hello,

I have been able to reproduce your issue, and have entered a bug report (UE-23381). Thank you for your report.

Have a great day,

Sean Flint
