#22002/1/8 15:57:48
上面的原文:
repeat while
Syntax
repeat while testCondition
statement(s)
end repeat
Description
Keyword; repeatedly executes statement(s) so long as the condition specified by testCondition is TRUE. This structure can be used in Lingo that continues to read strings until the end of a file is reached, checks items until the end of a list is reached, or repeatedly performs an action until the user presses or releases the mouse button.
While in a repeat loop, Lingo ignores other events. 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.
The Director player for Java doesn't detect mouse movements, update properties that indicate the mouse's position, or update the status of mouse button presses when Lingo is in a repeat loop.
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 starts the timer counting, resets the timer to 0, and then has the timer count up to 60 ticks:
on countTime
startTimer
repeat while the timer < 60
-- waiting for time
end repeat
end countTime
See also
exit, exit repeat, repeat with, keyPressed()
要不要翻下去?