I think that “named function” refers, for example, to nested functions defined using a keyword def. Consider the following example where it matters:
def foo: Int = {
val f: Int => Int = x => return x
f(58)
42
}
println(foo)
The part x => return xhere is the body of the abnormal function literal. The fact that a function literal is assigned to a variable with a name fdoes not affect the operator return: when it is reached return, the whole method is returned foo. In this case, he returns 58, and 42will never be reached.
:
def bar: Int = {
def f(x: Int): Int = {
return x
}
f(58)
42
}
println(bar) // returns 42
return f, bar. f(58) 58 . bar 42.
"" , "" . , f - , , bar, , bar, "", "".