• 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: Understanding a repeat loop (strings/characters)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understanding a repeat loop (strings/characters)


  • Subject: Re: Understanding a repeat loop (strings/characters)
  • From: Emmanuel <email@hidden>
  • Date: Sun, 23 Feb 2003 15:06:46 +0100

At 1:35 AM +0000 23/02/03, has wrote:

Because your use of the 'repeat with foo in bar' structure implies that
bar is a list that AS can repeat through. It's not; but certain data
types can be coerced to a list; so AS does this silently.

Incorrect. The 'repeat with itemRef in val' structure iterates over an object's items. Both strings and lists have 'item' elements, so either may be used here. And since in strings 'item' is synonymous with 'character', what you end up with is a reference to each character.

Surprising but obviously true: the behavior of the loop won't depend on what the text item's delimiters are, thus it looks like the string is never made into a list (which would involve the t.i.ds).

Emmanuel
_______________________________________________
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.

  • Follow-Ups:
    • repeat with i in string optimization was Re: Understanding a repeat loop (strings/characters)
      • From: Paul Skinner <email@hidden>
References: 
 >Re: Understanding a repeat loop (strings/characters) (From: has <email@hidden>)

  • Prev by Date: Re: Understanding a repeat loop (strings/characters)
  • Next by Date: Re: Help -- going posix space crazy
  • Previous by thread: Re: Understanding a repeat loop (strings/characters)
  • Next by thread: repeat with i in string optimization was Re: Understanding a repeat loop (strings/characters)
  • Index(es):
    • Date
    • Thread