From: Joel VanderWerf Date: 2007-11-16T07:11:10+09:00 Subject: Re: (1..5) === 3 > true 3 === (1..5) > false Michael Chow wrote: > (1..5) === 3 > true > 3 === (1..5) > false > > Is this a bug or expected behavior? From my understanding it shouldn't > matter on which side of an equal comparison an expression appears. It's normal for the #=== operator to be asymmetric, even though it looks symmetric. The LHS is treated as a _pattern_ for matching the RHS. For example: String === "foo" uses different criteria than "foo" === String and likewise for /fo/ === "foo" vs "foo" === /fo/ Also, note that #=== is used in case statements. case 3 when 1..5 ... end works as you expect, because it is equivalent to if (1..5) === 3 ... end But this wouldn't make sense: case 1..5 when 3 ... end so it really needs to be asymmetric. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407