Re: Silly repeat question
Re: Silly repeat question
- Subject: Re: Silly repeat question
- From: Alex Zavatone <email@hidden>
- Date: Thu, 26 Aug 2010 15:31:31 -0500
On Aug 26, 2010, at 1:48 PM, Emmanuel LEVY wrote:
yes, so there are various tricks, mainly the "repeat 1" trick and the "error "next repeat" " trick:
On Aug 26, 2010, at 12:32pm, Alex Zavatone wrote: Hmmm. This doesn't seem much better than an if/then statement to check a condition. Is it? Am I missing something?
What could be better than an if/then statement? When using a "next repeat" command there's bound to be a conditional _expression_ somewhere.
I don't want to put an if/then block around a decent chunk of code when I can simply do this beforehand:
set myCondition to CheckResult() if not myCondition then next repeat.
This way, I don't my code that follows indented within an if/then tell block. It's the nesting that I want to avoid.
Here's another illustration of the repeat 1 trick.
The Next repeat command (if such an animal existed in appleScript) would look like this:
if foo < 0 then next repeat And there wouldn't be a need for the inner repeat loop. But you would still need the if/then
repeat with x in {1, 2, 3, 5, 6, 7} repeat 1 times set foo to x - 5 if foo < 0 then exit repeat display dialog x end repeat end repeat
HTH,
ES
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden