This is the code I wrote.
The purpose of this code is to remove any unnecessary spaces at the end of a text.
But for some reason it keeps creating infinite loops and makes the whole project freeze.
Help needed
Develop games in your browser. Powerful, performant & highly capable.
First of all, there is a much easier way to remove spaces from the beginning or end of the string - use trim(text) expression.
Your loop never ends because you are not updating the TextInput text. You need to do this:
TextInput set text to left(......) Task set text to TextInput.text
And finally, I always add this condition to While loops, to prevent infinite loops:
loopindex<1000
So even if you created an infinite loop by accident, it will stop after 1000 iteration and will not freeze your browser.
Thank you very much for your elaborate explanation! Very helpful :)