Created
April 10, 2017 10:45
-
-
Save lameroid/35d1d2ade447e2aff663dbed1c2ac895 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
fun main(args: Array<String>) { | |
example(1 to Example()) { | |
x() | |
} | |
example(1 to "string") { | |
substring(2) | |
} | |
} | |
class Example { | |
fun x() = 7 | |
} | |
fun <T, R> example(pair: Pair<Int, T>, block: T.() -> R) { | |
val result: R = pair.second.block() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment