R
richB
# Sorry, very newbie question ...
C:/> ruby -v
ruby 1.8.2 (2004-12-25) [i386-mswin32]
C:/> irb
irb(main):001:0> a = 3.2
=> 3.2
irb(main):002:0> puts "match" if a.class==Float
match
=> nil
irb(main):003:0> puts "match" if a.class===Float
=> nil
irb(main):004:0>
Why does '==' match, and '===' does not. I am trying to use a case
statement on the class and it doesn't work because '===' is not giving
the newbie expected result.
Please don't hurt me. Thanks for your patience! - RichB
C:/> ruby -v
ruby 1.8.2 (2004-12-25) [i386-mswin32]
C:/> irb
irb(main):001:0> a = 3.2
=> 3.2
irb(main):002:0> puts "match" if a.class==Float
match
=> nil
irb(main):003:0> puts "match" if a.class===Float
=> nil
irb(main):004:0>
Why does '==' match, and '===' does not. I am trying to use a case
statement on the class and it doesn't work because '===' is not giving
the newbie expected result.
Please don't hurt me. Thanks for your patience! - RichB