I have following program in Scala :
object Ch4 {
def main(args: Array[String]) {
println("Hello, world!")
val x = sortMap()
println(x)
} //> main: (args: Array[String])Unit
def sortMap ( ) {
val scores = scala.collection.immutable.SortedMap ( "Alice" -> 10, "Fred" -> 7, "Bob" -> 3)
return scores
} //> sortMap: ()Unit
}
I am confused why sortMap function has return type Unit inspite of Map. Also why nothing is getting print in main function.
def sortMap ( ) = { ... }