• 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: Impossible "If"?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Impossible "If"?


  • Subject: Re: Impossible "If"?
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 11 May 2001 12:27:43 -0700

On 5/11/01 10:00 AM, "Andy Bachorski" <email@hidden> wrote:

> The above repeat statement will cause the count command to be executed for
> each iteration of the repeat statement. Not (too) big of a issue in the
> above case where the list is a local variable. But consider the following
>
> tell app "Finder"
> repeat with i from 1 to count of files in someFolder
> set anItem to file i of someFolder
> -- do something
> end repeat
> end tell
>
> In this script, a count command will be sent to the Finder for each
> iteration of the repeat loop. Depending on how many items are in the
> folder, this could significantly slow down the script. Better to count once
> before the repeat.

No, apparently that's not true, Andy. It only counts once, before doing the
repeat loop. So it does the same thing as your previous version. I agree
with you that it's simpler to use this method because it always works, so I
always use it for repeat loops myself instead of the 'repeat with x in
someList' method.

--
Paul Berkowitz


  • Follow-Ups:
    • Re: Impossible "If"?
      • From: Deivy Petrescu <email@hidden>
References: 
 >Re: Impossible "If"? (From: Andy Bachorski <email@hidden>)

  • Prev by Date: dialog box
  • Next by Date: prefab.com
  • Previous by thread: Re: Impossible "If"?
  • Next by thread: Re: Impossible "If"?
  • Index(es):
    • Date
    • Thread