Last active
December 12, 2015 10:39
-
-
Save sudowork/4760760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> "foo" + 4 | |
res0: String = foo4 | |
scala> 4 + "foo" | |
res1: String = 4foo | |
scala> 4 + "2.0" | |
res2: String = 42.0 | |
scala> 2 * "21" | |
<console>:8: error: overloaded method value * with alternatives: | |
(x: Double)Double <and> | |
(x: Float)Float <and> | |
(x: Long)Long <and> | |
(x: Int)Int <and> | |
(x: Char)Int <and> | |
(x: Short)Int <and> | |
(x: Byte)Int | |
cannot be applied to (String) | |
2 * "21" | |
^ | |
scala> // Stuff to come | |
scala> implicit def string2int(s: String) = s.toInt | |
string2int: (s: String)Int | |
scala> 2 * "21" | |
res3: Int = 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment