Created
May 20, 2018 17:33
-
-
Save genju83/6d956d3e62bccf8e43a0b6ce1b666df3 to your computer and use it in GitHub Desktop.
higher-order functions
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
fun main(args: Array<String>) { | |
println(sum(1, 3)) // 4 | |
} | |
fun sum(a: Int, b: Int) = higherOrderFunction2().let { | |
it(a, b) | |
} | |
fun higherOrderFunction2(): (Int, Int) -> Int { | |
return { a, b -> a + b } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment