From: dblack@... Date: 2007-07-24T19:11:45+09:00 Subject: Re: case equality question ---2049402039-636883661-1185271902=:1534 Content-Type: MULTIPART/MIXED; BOUNDARY="-2049402039-636883661-1185271902=:1534" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---2049402039-636883661-1185271902=:1534 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Tue, 24 Jul 2007, F. Senault wrote: > Le 24 juillet 2007 =E0 11:55, Phil Meier a =E9crit : > >> Why does Ruby goes to the when String case even if (param_value =3D=3D= =3D >> String) is false? > > I've been very suprised with this recently, but... > >>> 'a' =3D=3D=3D String > =3D> false >>> 1 =3D=3D=3D String > =3D> false > >>> String =3D=3D=3D 'a' > =3D> true >>> String =3D=3D=3D 1 > =3D> false Don't be surprised -- it would be very weird the other way. You'd have to do: case String when "abc" and so forth. It wouldn't really be useable as the basis of a case structure. David --=20 * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com) ---2049402039-636883661-1185271902=:1534-- ---2049402039-636883661-1185271902=:1534--