Effective Scala, part 4 - function v/s method


A function is a value in Scala, while a method is not. So the former can be passed as a parameter of a function or a method, and can be returned as a value. Method cannot do any of those.

A function is a value in Scala. All values are objects in Scala. An object can have methods. So a function in Scala can have methods.

Any function in Scala has a default apply method. inc(1) is a shorthand for inc.apply(1).