Wondering if you can comment on why following two scenarios behave differently:
The following works:
var la= List(12, 13 , 14 ,15);
var func = (x:Int) => println(x)
la.foreach(func) // 1
la.foreach(func(_)) // 2
But the following does not:
var la= List(12, 13 , 14 ,15);
var func1 = (x:Int) => {
for (i <- 0 to x) yield i*2
} mkString
la.foreach(println(func1)) // similar to 1 above
la.foreach(println(func1(_))) // similar to 2 above
error: type mismatch; found : Unit required: Int => ? la.foreach(println(func1(_)))