Skip to content

Instantly share code, notes, and snippets.

@harryhan24
Created June 1, 2018 16:44
Show Gist options
  • Select an option

  • Save harryhan24/34ea310ade68975a2b2430f23c53ae29 to your computer and use it in GitHub Desktop.

Select an option

Save harryhan24/34ea310ade68975a2b2430f23c53ae29 to your computer and use it in GitHub Desktop.
private fun printResult(body: (Int, Int) -> Int) {
println(body(10, 5))
}
fun sum(a: Int, b: Int) = a + b
fun subtract(a: Int, b: Int) = a - b
printResult(::sum) //result = 15
printResult(::minus) //result 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment