[SOLVED] When you meet the Endless loop while using the Thunkable(;´д`)ゞ

This is the requirement to use the loop like while or count in Thunkable.

But my codes fell into the Endless loop(;´д`)ゞ

I don’t know what’s wrong with it, which takes me 2h to find the problems but failed. Do you know how to make the correct codes and avoid the Endless loop?

You have an endless loop because the value of i2 starts out as 4 which is greater than or equal to 1 and it never changes inside of the loop. So the while condition is always true.

Just an aside that I find it really confusing that you’re using numbers within your variable names. I don’t recommend that.

An easier way to solve this is to consider “1234” as text rather than a number and use the substring block in the Text drawer to shorten the text string each time through the loop. If you’re required to use math blocks then I recommend renaming i2 and j2 to define what they actually are used for and then figuring out when the value of i2 should change inside of your loop. A math method would be to divide the number by 10 and round down since 1234/10 = 123.4 which rounds to 123; 123/10 = 12.3 which rounds down to 12; etc.

2 Likes

Sorry,because of study, I didnt’t notice your answer, but thanks for your sinserely help.

1 Like