Java to Kotlin converter: fixed some bugs in switch statement conversion
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//file
|
||||
public class C {
|
||||
public static void main(String[] args) {
|
||||
switch (args.length) {
|
||||
case 1: {
|
||||
int a = 1;
|
||||
System.out.print("1");
|
||||
}
|
||||
|
||||
case 2: {
|
||||
int a = 2;
|
||||
System.out.print("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
public class C {
|
||||
class object {
|
||||
public fun main(args: Array<String>) {
|
||||
when (args.size) {
|
||||
1 -> {
|
||||
run {
|
||||
val a = 1
|
||||
System.out.print("1")
|
||||
}
|
||||
run {
|
||||
val a = 2
|
||||
System.out.print("2")
|
||||
}
|
||||
}
|
||||
|
||||
2 -> {
|
||||
val a = 2
|
||||
System.out.print("2")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun main(args: Array<String>) = C.main(args)
|
||||
Reference in New Issue
Block a user