Re: Comparing strings
Re: Comparing strings
- Subject: Re: Comparing strings
- From: Andy Wylie <email@hidden>
- Date: Sat, 01 Jun 2002 21:35:53 +1200
on 1/6/02 6:48 PM +1200: 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"?
it's a reference to the item...
repeat with c in {"all", "none"}
tell c to return it
end repeat
-- item 1 of {"all", "none"}
you can use this form...
set x to {"all", "none"}
repeat with n from 1 to count x
log x's item n = "all"
end repeat
--true
-- false
or use contents or a coercion to get the item...
repeat with c in {"all", "none"}
log c's contents = "all" -- always returns "false"
end repeat
--true
-- false
repeat with c in {"all", "none"}
log c as string = "all" -- always returns "false"
end repeat
--true
-- false
_____________________________ Andy
_______________________________________________
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.