Core concept

def sq(n: Int): Int = n * n     // method
val sq2: Int => Int = n => n * n // function
Advertisement

How it works

Methods auto-eta-expand to functions when used as values.

Advertisement

Trade-offs + gotchas

Method for named + parameterized. Function for storage/passing.