# "Break out of loop" block not working

**URL:** <https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197>\
**Category:** Questions about Thunkable X\
**Tags:** loops\
**Created:** [March 26, 2020, 4:09pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197 "2020-03-26T16:09:00Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![julianair2002874i](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@julianair2002874i](https://community.thunkable.com/u/julianair2002874i)\
**Post date:** [March 26, 2020, 4:09pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/1 "2020-03-26T16:09:00Z")

</div>

Hi, when i inserted the “break out of loop” block into my app it gave me a notification that went like this:  
“Internal error generating code for blocks”

I hope Thunkable Support can get this sorted out as soon as possible. Thanks.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [March 26, 2020, 4:34pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/2 "2020-03-26T16:34:11Z")

</div>

> [@julianair2002874i](#):
>
> code for blocks”
> 
> I hope Thunkable Support can get this sorted out as soon as possible. Thanks.

Hi! @julianair2002874i, can you try ‘hard refreshing’ your browser? There was an update pushed out in the last couple days to address what you are talking about i think.

I am also imagining you are using Thunkable X, is that correct?

---

<div class="post-metadata">

**Author:** ![julianair2002874i](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@julianair2002874i](https://community.thunkable.com/u/julianair2002874i)\
**Post date:** [March 26, 2020, 4:46pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/3 "2020-03-26T16:46:56Z")

</div>

Just tried out the hard refreshing, still facing the issue. Thanks though! And yes, I am using Thunkable X.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [March 26, 2020, 4:48pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/4 "2020-03-26T16:48:45Z")

</div>

Weird. Can you post a share link to your app?

I’ll move this post to the #thunkable-cross discussion board.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [March 26, 2020, 5:14pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/5 "2020-03-26T17:14:37Z")

</div>

If you provide a share link I can check this out. I am unable to produce this error on my own.

---

<div class="post-metadata">

**Author:** ![julianair2002874i](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@julianair2002874i](https://community.thunkable.com/u/julianair2002874i)\
**Post date:** [March 26, 2020, 5:34pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/6 "2020-03-26T17:34:36Z")

</div>

Sorry, I would love for you to help but my app is confidential for now as it is being made for personal use and contains some API keys and passwords.

---

<div class="post-metadata">

**Author:** ![clevercode216l](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@clevercode216l](https://community.thunkable.com/u/clevercode216l)\
**Post date:** [June 5, 2021, 4:57am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/7 "2021-06-05T04:57:51Z")

</div>

Has a fix been found? When using the “break out of loop” block it crashed in live test mode.

-Sam

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [June 5, 2021, 5:03am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/8 "2021-06-05T05:03:07Z")

</div>

There wasn’t any problems. Someone reported an issue but does not want to show the project or create a minimalised project showing the problem.

No one can fix a problem that cannot be reproduced.

---

<div class="post-metadata">

**Author:** ![clevercode216l](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@clevercode216l](https://community.thunkable.com/u/clevercode216l)\
**Post date:** [June 6, 2021, 4:16am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/9 "2021-06-06T04:16:17Z")

</div>

So this is part of my code. It is a game with a leaderboard. This is testing if the players score is higher than others on the leaderboard OR if they tied it has to check each score it tied with to find fastest time. I need it to stop once determines it has “beat” another score and give me that position in the list so the players name and score can be inserted and the list updated.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/f/bfab5716967fc900af712f9c6887e7fe9c75c8ed.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [June 6, 2021, 1:46pm UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/10 "2021-06-06T13:46:38Z")

</div>

How do you know that `break out of loop` is not working in this code?

---

<div class="post-metadata">

**Author:** ![clevercode216l](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@clevercode216l](https://community.thunkable.com/u/clevercode216l)\
**Post date:** [June 8, 2021, 12:23am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/11 "2021-06-08T00:23:02Z")

</div>

So when I test code without the block thunkable does not crash, as soon as I put it back in thunkable freezes and I must close and reopen everything. I do not know if it just because it is in live testing or what but it will complete freeze. I tested this one if statement at a time with a label so I know it will run through each statement, but I need it to stop the loop when it returns the first true statement, not the whole list.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [June 8, 2021, 1:46am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/12 "2021-06-08T01:46:04Z")

</div>

You are breaking out of an inner loop not the outer loop and using the same looping variable “i” in both loops which reset the counter of the outer loop every time a breakout takes place.

If you register your code you would realise that you are only executing the inner loop at the end of the outer loop which means you can taker the inner loop outside and make it execute immediately after the first loop to get the `break out of loop` to work properly.

---

<div class="post-metadata">

**Author:** ![clevercode216l](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@clevercode216l](https://community.thunkable.com/u/clevercode216l)\
**Post date:** [June 10, 2021, 5:47am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/13 "2021-06-10T05:47:18Z")

</div>

I changed the variable “i” and it now works. Thank you for pointing that out, I didnt realize that it was hanging up that way.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:39am UTC](https://community.thunkable.com/t/break-out-of-loop-block-not-working/537197/14 "2024-11-08T11:39:36Z")

</div>


