arekolek
06/08/2018, 6:44 AMShawn
06/08/2018, 6:46 AM<http://khttp.async.post|khttp.async.post>()
there’s an optional onResponse
param that takes Response.() -> Unit
.let
JSONObject.getString()
with a nonexistent key would return null
, so for a bit there, the last line was a ?.let { log }
arekolek
06/08/2018, 6:52 AMShawn
06/08/2018, 6:54 AMinterface Foo {
val string: String?
fun frobnicate(block: Foo.() -> Unit)
}
fun consume(foo: Foo) {
val baz = { lad: Foo ->
lad.string?.let(::println)
}
foo.frobnicate(baz)
}
val baz: (Foo) -> Unit
fixes it?: Unit
onto the let
linearekolek
06/08/2018, 7:12 AMfun consume(foo: Foo) {
val baz: Foo.() -> Unit = {
string?.let(::println)
}
foo.frobnicate(baz)
}
gildor
06/08/2018, 7:47 AM