Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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.
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:
So even if you created an infinite loop by accident, it will stop after 1000 iteration and will not freeze your browser.
Develop games in your browser. Powerful, performant & highly capable.
Thank you very much for your elaborate explanation! Very helpful :)