sreich
04/02/2017, 12:31 AMjk
04/02/2017, 10:50 AMbar()
returns a boolean - the when could be written this to achieve the same result:
when(blah) {
Thing.Value -> bar()
}
sreich
04/02/2017, 11:07 AMsreich
04/02/2017, 11:08 AMfun bizz(a: Int) = when (a) {
1 -> {
bar()
true
}
2 -> {
if (foo()) {
doStuff()
true //"this statement is unused"..but why?
}
false
}
else -> true
jk
04/02/2017, 11:14 AMif (foo()) {
doStuff()
true //"this statement is unused"..but why?
}
false
sreich
04/02/2017, 11:15 AMsreich
04/02/2017, 11:15 AMsreich
04/02/2017, 11:15 AMjk
04/02/2017, 11:16 AMsreich
04/02/2017, 11:16 AMjk
04/02/2017, 11:19 AMif (foo()) {
doStuff()
true
} else {
false
}
sreich
04/02/2017, 11:23 AMkingsley
04/02/2017, 11:59 AMreturn@when
. Not sure if that works currently. Or you could just put a label at the when and return@label