Skip to content

Instantly share code, notes, and snippets.

@genju83
Created May 20, 2018 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genju83/6d956d3e62bccf8e43a0b6ce1b666df3 to your computer and use it in GitHub Desktop.
Save genju83/6d956d3e62bccf8e43a0b6ce1b666df3 to your computer and use it in GitHub Desktop.
higher-order functions
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