How about this:
val double = (_: Int) * 2
Note Here double is Function , not method . In the first example, you defined a method called double with a return type of Function . In your second example, you simply defined a method . Function is different from method in Scala.
If the compiler can get type information, we can write Function even simply:
scala> def apply(n: Int, f: Int => Int) = f(n) apply: (n: Int, f: Int => Int)Int scala> apply(10, 2*) res1: Int = 20 scala> apply(10, 100+) res2: Int = 110
source share