Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

7.toBinayString does not work in scala REPL, but with val k=7 it works [closed]

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?

like image 575
user unknown Avatar asked Jan 14 '12 08:01

user unknown


1 Answers

Because of the spelling mistake.

toBinayString -> toBinaryString 

enter image description here

like image 107
missingfaktor Avatar answered Oct 23 '22 11:10

missingfaktor