An animation loop needs to let the window be updated periodically, as otherwise you would never see a display. A convenient way to do this is to place a "rate" statement inside the loop. For example, "rate(200,wait)" means "execute this loop about 200 times per second, waiting periodically, about 60 times per second, for the window to be updated".
There is another way to manage an animation, a way that is more standard in JavaScript programs and can be useful in certain kinds of situations. Instead of putting your calculations inside a loop, you put them inside a function and arrange to have that function executed periodically. As a practical matter, the highest rate of executions you can get is about 60 per second, which is tied to the rate of window updates. If you use this timer-oriented scheme, but you need to perform about 200 calculational updates per second, you need to do about 3 calculational updates every time your function is executed (60*3 = 180 calculational updates per second). Of course if your calculations take a long time, which blocks window updates, you won't get 60 executions of your function per second.
In the GlowScript example programs there are now two examples of the ball bouncing in a box that use the timer scheme. Do take a look.