When I use scala console, it prints an object in a clear style, e.g.
scala> val mike = ("mike", 40, "New York")
mike: (java.lang.String, Int, java.lang.String) = (mike,40,New York)
But if I write in a script file, like:
val mike = ("mike", 40, "New York")
println(mike)
It only prints:
(mike,40,New York)
How can I do in script file like the scala console? Is there a method for this?
You can retrieve the type of a variable with a Manifest:
If the inferred type
Tis an abstract type, there must be an implicitManifest[T]provided, otherwise this won’t compile.You could make a version that provides a default for the implicit
Manifest[T]parameter in this case: