Implement if-to-when and when-to-if transformations
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
if (n == 1) {
|
||||
res = "one"
|
||||
} else if (n == 2) {
|
||||
res = "two"
|
||||
} else {
|
||||
res = "???"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
when (n) {
|
||||
1 -> {
|
||||
res = "one"
|
||||
}
|
||||
2 -> {
|
||||
res = "two"
|
||||
}
|
||||
else -> {
|
||||
res = "???"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts 'when' expression to one or more 'if' expressions
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user