Skip to content

Instantly share code, notes, and snippets.

@lameroid
Created April 10, 2017 10:45
Show Gist options
  • Save lameroid/35d1d2ade447e2aff663dbed1c2ac895 to your computer and use it in GitHub Desktop.
Save lameroid/35d1d2ade447e2aff663dbed1c2ac895 to your computer and use it in GitHub Desktop.
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