example working with scala 1 (include auto-completion)

Get The Hang

$ 4.2.29 2 502---> scala
Welcome to Scala version 2.9.2 (OpenJDK 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 6/3
res0: Int = 2

scala> res0.
%              &              *              +              -              /              >
>=             >>             >>>            ^              asInstanceOf   isInstanceOf   toByte
toChar         toDouble       toFloat        toInt          toLong         toShort        toString
unary_+        unary_-        unary_~        |

scala> res0.*
                           def *(x: Byte): Int        def *(x: Char): Int        def *(x: Double): Double
def *(x: Float): Float     def *(x: Int): Int         def *(x: Long): Long       def *(x: Short): Int

scala> res0.*
:9: error: ambiguous reference to overloaded definition,
both method * in class Int of type (x: Char)Int
and  method * in class Int of type (x: Short)Int
match expected type ?
              res0.*
                   ^

scala> res0.to
toByte     toChar     toDouble   toFloat    toInt      toLong     toShort    toString

scala> res0.to
toByte     toChar     toDouble   toFloat    toInt      toLong     toShort    toString

scala> res0.toS
toShort    toString

scala> res0.toString
res2: java.lang.String = 2

scala> res2*2
res3: String = 22

scala>

Leave a comment

Your email address will not be published. Required fields are marked *