I am a little confused by the various uses of the 'block' {...} contruct in scala especially when calling a higher order function like in the following example.
def higherOrder(func: Int => Int): Int = {
func(4)
}
val f = ((x: Int) => x*x)
Then I can call higherOrder like so:
higherOrder(f)
, orhigherOrder {f}
, orhigherOrder { x => x*x }
(1) is obvious, but I can not wrap my head around how the syntax for (2) and (3) are parsed by the compiler Can somebody explain what (2) and (3) correspond to, with regard to the language specification?