Hi,
Anonymous functions in Scala is the lightweight syntax to create a function in one line of code. We’ve been using this in our articles so far. Anonymous functions are functioning literals, and at runtime, they instantiate into objects called function values.
Let's take an example:
scala> val x=()=>println("Hello")
x: () => Unit = $$Lambda$1122/1244890076@72ce8a9b
scala> x()
Result:
Hello