• 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: More about Records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More about Records


  • Subject: Re: More about Records
  • From: "Serge Belleudy-d'Espinose" <email@hidden>
  • Date: Thu, 4 Jan 2001 11:11:57 +0100

At 0:54 -0500 4/01/01, email@hidden wrote:

>Its sometimes tricky to see when things are references, since if you ask for the class of one, it gets its contents evaluated. This is related to the old "comparison inside a 'repeat with' loop" problem.
>
> set primes to {2,3,5,7,11}
> repeat with aPrime in primes
> if 7 is aPrime then display dialog "Seven is too a prime!"
> end repeat
>
>and you see no dialog. That's because aPrime on the fourth iteration isn't 7,
>but "item 4 of {2,3,5,7,11}". Because "is" doesn't force the reference to spit out its contents, the comparison becomes a number compared to a reference. And if the classes aren't the same, the result is always false.

Thank you for making it so clear.
I think you should add that it's easy to solve this problem by forcing the item to coerce to its real value. With your example

if 8 is (aPrime+1) then display dialog "Seven is too a prime!"

will work, as will adding a string to a reference to a string etc.

Serge

__ __ __
_ \///\/ _ I N S T I T U T | Serge Belleudy-d'Espinose - IJM
\///\/// J A C Q U E S | 2 place Jussieu - 75251 Paris Cedex 05
_///\///\_ M O N O D | m@il : email@hidden
__/\///\__ Service Informatique | WWW : http://www.ijm.jussieu.fr/


References: 
 >Re: More about Records (From: email@hidden)

  • Prev by Date: Chevrons (Re: Identifying app by creator code??)
  • Next by Date: Re: Newie To AppleScripts, would like someone to look over a script
  • Previous by thread: Re: More about Records
  • Next by thread: Re: More about Records
  • Index(es):
    • Date
    • Thread