Syntax
repeat 2 times
exit repeat
end repeat
Description
The exit statement causes the flow of script
execution to leave the exit
statement's repeat loop. The
execution then resumes with the script code following the
repeat loop. exit can only be
used inside of a repeat loop, regardless of the
repeat-loop variation. Using
exit is the conventional way to exit a
repeat loop that has no conditional statement
associated with it, as shown in this example. In other words, this
form of repeat is an infinite loop:
repeat
set userReply to the text returned of (display dialog "Want to get¬
out of this endless loop?" default answer "")
if userReply is "yes" then exit repeat
end repeat
This endless loop can also be exited by clicking the Cancel button on
the dialog produced by display dialog, which
terminates the execution of the script.
|