loop()

The loop function is called by Bitsbox twenty times every second. Define your own loop function to repeat some code over and over.

Here's a program. Its loop function draws an apple on the screen, each time a different size.

Here's one that uses a counter to fade the screen color from black to white.

Often you may want to stop a loop operation once an event occurs, such as when a game is won or lost. In such a case, setting the loop function to null will do what you need.