'Else' is not required in 'when' if Unit is expected

This commit is contained in:
Andrey Breslav
2013-09-12 22:04:34 +02:00
parent a76f1c1db5
commit c017858f77
17 changed files with 170 additions and 14 deletions
@@ -0,0 +1,11 @@
var r = "Fail 0"
fun foo(x: Int) {
return when (x) {
1 -> { r = "OK" }
}
}
fun box(): String {
foo(1)
return r
}