Hi,
An anonymous function in Scala is a function literal. At runtime, Scala instantiates into a function value. Since this is a way to create a function using just one line of code, we can call it lightweight.
Here’s an example:
scala> val mul=(a:Int,b:Int)=>a*b
mul: (Int, Int) => Int = $$Lambda$1541/400146874@3aca06a3
scala> mul(3,4)