Lambdas are like anonymous functions and can be passed as arguments for higher-order functions such as .map()
and look like:
val square = (x: Int) => {
x * x
}
However, if your lambda's body has a single statement, you can write it as:
val square = (x: Int) => x * x
This is a short hand syntax and is succinct.