3 ms·
This particular quirk also holds true of, say, Ruby or Python: 256 is 256 # True (2**50) is (2**50) # False albeit without Java's fear of oper
by jeorgun 12y ago
This particular quirk also holds true of, say, Ruby or Python:
256 is 256 # True
(2**50) is (2**50) # False
albeit without Java's fear of operator overloading and the counterintuitiveness it causes.
- dkannan 12y agoComparison works as expected in Ruby Have checked in ruby 2.1.2p95 code: > (250).class #=> Fixnum > (250) == (250) #=> true > (2100).class #=> Bignum > (2100) == (2100) #=> true
- jeorgun 12y agoComparisons work, but Ruby's == isn't the same as Java's; what I was referring to was 250.object_id == 250.object_id # true (2**70).object_id == (2**70).object_id # false