• 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: Comparing strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing strings


  • Subject: Re: Comparing strings
  • From: Deivy Petrescu <email@hidden>
  • Date: Sat, 1 Jun 2002 12:20:40 -0400

At 11:48 PM -0700 5/31/02, Gil Dawson wrote:
>I apologize if this question has been asked, but I can't seem to find it:
>
>In Applescript 1.7 using ScriptEditor 1.6 (MacOS 9.2.2) the following
>scriptette:
>
>repeat with C in {"all", "none"}
> log C
> log class of C --always "string"
> log C = "all" -- always returns "false"
>end repeat
>
>produces the following log:
>
> (*all*)
> (*string*)
> (*false*)
> (*none*)
> (*string*)
> (*false*)
>
>Why does the last line always return "false"?


Andy's explanations is right on target.
But you've could of saved sometime if you'd change your script to

repeat with C in {"all", "none"}
log C
log class of C --always "string"
log C = "all" -- always returns "false"
return C -- item 1 of {"all", "none"}
end repeat

so item 1 of {"all,"none"} is not = "all" untill you coerce it.
a variable is a container.

set a to 2
if a=2 then say "a is two"

Because of the if statement a is going to be coerced to the value
that it contains 2. C, in your script, is coerced to item 1 of
{"all", "none"} and it has to be coerced again to "all".

Regards
--
Deivy Petrescu
http://www.dicas.com
_______________________________________________
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.

  • Prev by Date: No desktop?
  • Next by Date: Re: iTunes player state?
  • Previous by thread: Re: Comparing strings
  • Next by thread: Re: 1 to 001 & the duplicate command
  • Index(es):
    • Date
    • Thread