User Guide

222 Chapter 11: Keywords
While in a repeat loop, Lingo ignores other events. To check the current key in a repeat loop, use
the
keyPressed property.
If you need to process something for several seconds or more, evaluate the function in a loop with
some type of counter or test to track progress.
If the stop condition is never reached or there is no exit from the repeat loop, you can force
Director to stop by using Control+Alt+period (Windows) or Command+period (Macintosh).
Example
This handler contains a repeat loop that counts down from 20 to 15:
on countDown
repeat with i = 20 down to 15
sprite(6).member = 10 + i
_movie.updateStage()
end repeat
end
repeat with...in list
Usage
-- Lingo syntax
repeat with variable in someList
Description
Keyword; assigns successive values from the specified list to the variable.
While in a repeat loop, Lingo ignores other events except keypresses. To check the current key in
a repeat loop, use the
keyPressed property.
Only one handler can run at a time. If Lingo stays in a repeat loop for a long time, other events
stack up waiting to be evaluated. Therefore, repeat loops are best used for short, fast operations or
when users are idle.
If you need to process something for several seconds or more, evaluate the function in a loop with
some type of counter or test to track progress.
If the stop condition is never reached or there is no exit from the repeat loop, you can force
Director to stop by using Control+Alt+period (Windows) or Command+period (Macintosh).
Example
This statement displays four values in the Message window:
repeat with i in [1, 2, 3, 4]
put(i)
end repeat