Skip to content

Instantly share code, notes, and snippets.

@NitinPraksash9911
Created March 6, 2020 08:34
Show Gist options
  • Save NitinPraksash9911/ac98583a27853aa5d7be523b2d337242 to your computer and use it in GitHub Desktop.
Save NitinPraksash9911/ac98583a27853aa5d7be523b2d337242 to your computer and use it in GitHub Desktop.
/** Higher Order Function **/
fun funNameTwo(func:(Int)->Int):(Int)->Int{
val k = func(6)
return {x:Int->x*k}
}
/** calling above HOF **/
val test= funNameTwo({it*4})
val s = test(7)
println(s) //it will print 168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment