KT-4008 'Replace if with when' is available but does not work

This commit is contained in:
Alexey Sedunov
2013-10-11 13:57:00 +04:00
parent e05e616158
commit eff62bfd83
7 changed files with 53 additions and 6 deletions
@@ -0,0 +1,10 @@
fun test(n: Int) {
val s = "test"
<caret>if (n == 0)
s = "zero"
else if (n == 1)
s = "one"
else if (n == 2)
s = "two"
return s
}
@@ -0,0 +1,9 @@
fun test(n: Int) {
val s = "test"
when (n) {
0 -> s = "zero"
1 -> s = "one"
2 -> s = "two"
}
return s
}
@@ -0,0 +1,9 @@
fun test(n: Int) {
val s = "test"
<caret>when (n) {
0 -> s = "zero"
1 -> s = "one"
2 -> s = "two"
}
return s
}
@@ -0,0 +1,7 @@
fun test(n: Int) {
val s = "test"
if (n == 0) s = "zero"
else if (n == 1) s = "one"
else if (n == 2) s = "two"
return s
}