2023-08-01 12:02:19 +00:00
|
|
|
import java.lang.Integer;
|
|
|
|
import java.lang.Object;
|
|
|
|
import java.lang.Float;
|
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public record Rec(Integer a, Object b) {}
|
2023-08-01 12:02:19 +00:00
|
|
|
|
|
|
|
public class Switch {
|
2024-03-14 12:50:56 +00:00
|
|
|
public main(o) {
|
2023-08-01 12:02:19 +00:00
|
|
|
return switch (o) {
|
2023-08-17 11:26:30 +00:00
|
|
|
case Rec(Integer a, Integer b) -> a + b;
|
|
|
|
case Rec(Integer a, Float b) -> a + 10;
|
|
|
|
case Rec(Integer a, Rec(Integer b, Integer c)) -> a + b + c;
|
|
|
|
case Integer i -> i;
|
2024-09-12 12:36:26 +00:00
|
|
|
//default -> 0;
|
2023-08-01 12:02:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|