Re: Re: Repeat With question (newbie level)
Re: Re: Repeat With question (newbie level)
- Subject: Re: Re: Repeat With question (newbie level)
- From: Michelle Steiner <email@hidden>
- Date: Wed, 14 Feb 2001 18:11:04 -0800
On 2/14/01 5:52 PM, email@hidden <email@hidden> wrote:
>
There is a caveat with this approach (which is a correct and very good
>
approach BTW, being standard Applescript and all). A script will demonstrate:
>
>
set alphaList to {"a", "b", "c"}
>
>
repeat with aLetter in alphaList
>
if aLetter is equal to "b" then beep 1
>
if aLetter is "b" then beep 1
>
if aLetter = "b" then beep 1
>
if aLetter is equal to "b" then beep 1
>
if (aLetter as string) is equal to "b" then beep 1 -- only this line
>
makes a beep
>
end repeat
This is true, but I don't understand why. Look at this:
set alphaList to {"a", "b", "c"}
repeat with aLetter in alphaList
if aLetter is equal to "b" then beep 1
if aLetter is "b" then beep 1
if aLetter = "b" then beep 1
if aLetter is equal to "b" then beep 1
if (aLetter as string) is equal to "b" then beep 1 -- only this line
makes a beep
end repeat
The log is
(*false*)
(*string*)
(*false*)
(*string*)
(*false*)
(*string*)
--Michelle
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spirtual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------