object HelloWorld { def main(args: Array[String]) { println("Higher Order Functions Examples: ") // combining any arithmatic operation println(sum(1,2,5, (a,b)=>a+b)) // or can be done by lambda expressions println(sum(3,5,9, _+_)) } def sum(a: Int, b: Int, c: Int, f :(Int, Int) => Int): Int = f(f(a,b),c) }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more