One of the most frequently posed Scala programming interview questions, be ready for it.   Scala allows passing a block of code in a function which is evaluated only when it is used. This kind of parameter is called a by-name parameter. By-name parameters are often used while defining a new control structure. Let’s take an example. def executionTime(f: => Any) = {
val start = System.currentTimeMillis() f
System.currentTimeMillis() - start
}
val t = executionTime { gcdList(List(18, 24, 36))
}