• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how?


  • Subject: Re: how?
  • From: "email@hidden" <email@hidden>
  • Date: Wed, 13 Jan 2010 20:05:16 -0800

>>>>>A "lonely" repeat statement collides with Applescript's only way to ensure the loop executes once.

I don't get what this means.  And I don't see how a

  repeat until x

ensures anything, particularly when the value x is never used.

If the loop repeats multiple times it will try to evaluate x with every repeat, which is not as efficient as comments.


If that's a programmer's trick, I think it's best forgotten.

>> “repeat … end” is guaranteed to execute at least once, and if you don’t intend it to execute more than once, it shouldn’t be a repeat loop.

repeat 1 times

Will only repeat 1 time and only 1 time, and it even has a use:

repeat
 repeat 1 times
    do stuff
    If a is true then exit repeat
--do stuff you want to do if a is false
  end repeat
--do stuff you want to do no matter what a is
end repeat

It allows you to set up a conditional that will bail out on part of a repeat loop, sort of a "next repeat" function.  A technique I learned on this list and have used in several scripts.

http://lists.apple.com/archives/applescript-users/2001/Jan/msg01204.html

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

  • Follow-Ups:
    • Re: how?
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: how? (From: Adam Morris <email@hidden>)
 >Re: how? (From: Chris Page <email@hidden>)
 >Re: how? (From: Adam Morris <email@hidden>)
 >Re: how? (From: Chris Page <email@hidden>)

  • Prev by Date: Re: how?
  • Next by Date: Re: how?
  • Previous by thread: Re: how?
  • Next by thread: Re: how?
  • Index(es):
    • Date
    • Thread