1.

What Is An Anonymous Function In Scala? What Is A Function Literal In Scala? What Are The Advantages Of A Anonymous Function/function Literal In Scala?

Answer»

Anonymous Function is ALSO a Function but it does not have any function NAME. It is also KNOWN as a Function Literal.

The advantages of a Anonymous Function/Function Literal in Scala:

  • We can ASSIGN a Function Literal to variable
  • We can pass a Function Literal to another function/method
  • We can return a Function Literal as another function/method result/return value.

Anonymous Function is also a Function but it does not have any function name. It is also known as a Function Literal.

The advantages of a Anonymous Function/Function Literal in Scala:



Discussion

No Comment Found