Created
June 1, 2018 16:44
-
-
Save harryhan24/34ea310ade68975a2b2430f23c53ae29 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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