Skip to content

Instantly share code, notes, and snippets.

@NitinPraksash9911
Last active March 6, 2020 08:32
Show Gist options
  • Save NitinPraksash9911/02800b8aeef56133905af27afffbf7eb to your computer and use it in GitHub Desktop.
Save NitinPraksash9911/02800b8aeef56133905af27afffbf7eb to your computer and use it in GitHub Desktop.
/** Higher Order Function **/
fun returnAfunc(a:Int):(Int)->Int{
return {x:Int->x*a}
}
/** calling above HOF **/
val func = returnAfunc(3)
val value = func(2)
println("value is $value") // value is 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment