Re: Comparing strings
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.