• 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: Strings as list items don't always compare as strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strings as list items don't always compare as strings


  • Subject: Re: Strings as list items don't always compare as strings
  • From: Deivy Petrescu <email@hidden>
  • Date: Sat, 23 Mar 2013 09:43:44 -0400

On Mar 23, 2013, at 01:55 , Jon Pugh <email@hidden> wrote:

>
> property a_list : {"a"}
> repeat with an_item in a_list
> 	display dialog an_item --displays "a" (without quotes)
> 	contents of an_item is "a" --FALSE!
> end repeat
>
> In this scenario, the variable of a repeat loop, an_item, is a reference, specifically “item 1 of a_list”.  Realizing this will make your life so much better.  You can get the contents of a reference to do what you expect.
>
> It’s not that mysterious.
>
> Jon
>

Jon,

You certainly mean:  contents of an_item is "a" --TUE!  as in not false

I  normally write my loops of this kind as

repeat with an_item in a_list
set an_item to contents of an_item
…
end repeat

Normally with this kind of code I get an_item to be what I expect it to be.


Deivy Petrescu
email@hidden




 _______________________________________________
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: Strings as list items don't always compare as strings
      • From: Stan Cleveland <email@hidden>
References: 
 >Strings as list items don't always compare as strings (From: Rob Lewis <email@hidden>)
 >Re: Strings as list items don't always compare as strings (From: Jon Pugh <email@hidden>)

  • Prev by Date: Re: Strings as list items don't always compare as strings
  • Next by Date: Solver: Play sounds via script
  • Previous by thread: Re: Strings as list items don't always compare as strings
  • Next by thread: Re: Strings as list items don't always compare as strings
  • Index(es):
    • Date
    • Thread