benleggiero
03/09/2017, 2:36 PMwhen
should change the scope so you can call functions on the parameter.
Like, I wish when
was declared like:
fun <T, R> when(target: T, block: T.()->R): R
So you could use it like:
return when(str) {
equals("foo") -> foo()
contains("bar") -> baz()
}