Re: If Statements
Re: If Statements
- Subject: Re: If Statements
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 13 Sep 2008 11:35:28 -0400
On Sat, Sep 13, 2008 at 11:08 AM, Ed Stockly <email@hidden> wrote:
> set userName to "5"
> log 10 > userName
> -->>true
>
> set userName to 5
> log userName < 10
> -->>true
> set userName to "5"
> log userName < 10
> -->false
>
> This makes no sense. Must be a bug?
Not a bug. The comparison seems to be based on the type of the left
hand side of the operator.
So (10 > "5") is true, because it converts the string to a number and
does a numeric comparison. But ("5" < 10) is false because it
converts the number to a string and does a lexicographic comparison.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden