Re: Exit Repeat [Was: [Case Statements]]
Re: Exit Repeat [Was: [Case Statements]]
- Subject: Re: Exit Repeat [Was: [Case Statements]]
- From: email@hidden (Michael Sullivan)
- Date: Tue, 12 Feb 2002 18:04:21 -0500
- Organization: Society for the Incurably Pompous
>
On Tuesday, February 12, 2002, at 07:14 AM, email@hidden
>
wrote:
>
>
>> and if you're wondering "what if I want to escape the outer repeat
>
>> loop?" ...
>
>
>
> What am I missing? Why not just
>
>
>
> set checked to false
>
> repeat while checked is false
>
> if myTest is not whatIwant then
>
> set checked to true
>
> end if
>
> end repeat
>
>
>
> It seems to me to be the best solution for an exit repeat from within
>
> as many nested ifs as you want.
>
>
It's *a* solution, but an exit statement is more concise and makes the
>
intent clearer. It's a matter of convenience of expression.
>
Technically, the only control structures you need to write a program are
>
"if" and "go to", but it makes things a lot more difficult.
>
>
Just so folks know, we have enhancement requests filed for both "case"
>
and "exit repeat."
Don't we already have "exit repeat"? I could swear I've used it.
Yes we do, I just tested it.
set myText to ""
repeat with i from 1 to 55
set myText to myText & "a"
if i = 10 then
exit repeat
end if
end repeat
myText
--> "aaaaaaaaaa"
So, it's "next repeat" that we're looking for. Well, sort of, I'm
definitely less interested in this than in other (much more difficult to
implement, of course) things.
Michael, Oh, I see what you're doing... I guess exit repeat is real
easy to implement, eh? :)
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.