Repeat lines until an event happens

I’m new here, and I’m simply searching for a way to repeat a line of code unlimited times (in one draw passing) until the wanted event happens. Is there any way to do so?

Hi Schred,

That’s the goal of the while structure.

Check the reference:


Okay, thanks :smiley:

What type of event? If we are talking about a key or mouse event, then you need to make sure draw() is not held hostage by your while loop as these types of events are queued and processed at the beginning of each cycle of draw(). If you don’t let draw() run normally, then you won’t be able to manage those input events properly.


1 Like

I managed to do it with the while() command. Thanks anyways :slight_smile:

1 Like