Closure
  • A closure is a function, whose return value depends on the value of one or more variables declared outside this function
  • object Demo {
       def main(args: Array[String]) {
        var factor = 3
        val multiplier = (i:Int) => i * factor
    
        println(multiplier(10));
       }
    }