Skip to content

Instantly share code, notes, and snippets.

@erokhins
Last active December 19, 2015 11:39
Show Gist options
  • Select an option

  • Save erokhins/5949535 to your computer and use it in GitHub Desktop.

Select an option

Save erokhins/5949535 to your computer and use it in GitHub Desktop.
attr val example
class B {
val attr = Attr()
class Attr {
var name: String = ""
var width: Int = 0
fun invoke(f: Attr.() -> Unit) {
this.f()
}
}
}
fun main(args: Array<String>) {
with(B()) {
attr.name = "43"
attr {
name = "35"
width = 2
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment