User Guide
220 Chapter 11: Keywords
Example
This statement changes the second line of the field cast member Review Comments to “Reviewed
by Agnes Gooch”:
put "Reviewed by Agnes Gooch" into line 2 of member("Review Comments")
The same can be accomplished with a text cast member using this syntax:
put "Reviewed by Agnes Gooch" into member("Review Comments").line[2]
See also
char...of, item...of, line...of, paragraph, word...of, put...before,
put...after, set...to, set...=
repeat while
Usage
-- Lingo 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.
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 milliseconds:
on countTime
_system.milliseconds
repeat while _system.milliseconds < 60
-- waiting for time
end repeat
end countTime
See also
exit, exit repeat, repeat with, keyPressed()