fun test_1(cond: Boolean) { val x = when (cond) { true -> 1 } val y = when (cond) { false -> 2 } val z = when (cond) { true -> 1 false -> 2 } } fun test_2(cond: Boolean?) { val x = when (cond) { true -> 1 false -> 2 } val y = when (cond) { true -> 1 false -> 2 null -> 3 } } fun test_3(cond: Boolean) { when (cond) { true -> 1 } }