This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Higher Order Function **/ | |
fun funName(a: Int, func: (Int, Int) -> Int) { | |
val s = func(a,5) | |
println(s) | |
} | |
/** calling above HOF **/ | |
val a: Int = 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Higher Order Function **/ | |
fun funName(a: Int, func: (Int) -> Int) { | |
val s = func(a) | |
println(s) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** normal function **/ | |
fun methodName(data: String) { | |
println(data) | |
} | |
/** lambda expression **/ | |
val test = {data:String-> println(data) } |
NewerOlder