fun foo() { return false fun a() = {when(x) { is a -> b }} // foo fun b() {} } fun foo() { when (e) { } when (e) { is a -> foo } when (e) { is Tree #(a, b) -> foo is null -> foo is 1 -> foo is A.b -> foo is 1.0 -> foo is 'c' -> foo is "sadfsa" -> foo is """ddd""" -> foo is * -> foo is val a is Foo -> foo is #(val a is Foo, b) -> foo } when (when(when (e) { }) { }) { } } fun foo() { when (val a = e) { is Tree -> c is Tree #(null, val r) -> c is a #(a, b) -> c is a #(a, b) -> c is a.a #(a, b) -> c is a.a #(foo = a, bar = b) -> c is package.a.a #(a, b) -> c is a #(val a is T, b) -> c is a #(b, 1) -> c in 1..2 -> dsf !in 2 -> sd !is t -> d is (foo) -> Bar -> fgpp is #(1, val a is Foo, *, Foo, bar) -> d is #(Foo, val a in 1..2, *, val _ !is Foo, val bar is foo.bar #(a)) -> d is #(Int, Int) -> 2 is val a : Foo -> 2 else -> foo } } fun foo() { when (val a = e) { is Tree, is Tree #(null, val r), is a #(a, b) -> c 1, foo(), bar, 2 + 3, is a #(a, b) -> c is a.a #(val b, b) -> c } } fun whenWithoutCondition(i : Int) { val j = 12 when { 3 -> -1 i == 3 -> -1 j < i, j == i -> -1 i is Int -> 1 else -> 2 } }