scala> val s = 7.toBinayString
<console>:7: error: value toBinayString is not a member of Int
val s = 7.toBinayString
^
scala> val k = 7
k: Int = 7
scala> k.toBinaryString
res44: String = 111
Since val k = 7 and 7 are identified as Int, not as RichInt or java.lang.Integer I don't see why they are handled differently.
Why is there a difference?
Because of the spelling mistake.
toBinayString -> toBinaryString
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With