Re: exit this repeat loop
Re: exit this repeat loop
- Subject: Re: exit this repeat loop
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 12 Sep 2005 16:23:15 -0400
On 9/12/05, Robert Poland <email@hidden> wrote:
> That repeat loop is inside another one, and this only quits the
> inside one. Is there a simple way to quit the script?
As far as I know:
* You can use "exit" to terminate the innermost repeat loop.
* You can use "return" to terminate the current handler (or the whole
script, if the "return" is not
inside a handler)
* There is no simple syntax for terminating any loop other than the
innermost one
If you can't easily arrange for the two loops to be in their own
handler, which would make "return" do what you want, I would use a
try/error block - throw a bogus error to get out of the loop, and
catch and ignore it at the level you want to exit to:
try
repeat with i from 1 to 10
repeat with j from 1 to 10
log (i*j)
error "done"
end
end
on error "done"
-- not really an error, do nothing
end
> --
> Bob Poland - Fort Collins, CO
> http://www.ibrb.org/
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden