E
Size: a a a
λ
E
λ
E
λ
λ
AK
AK
λ
M
E
DF
АГ
Т8
M
DF
DF
E
Т8
var operation = 2;
var result = operation switchJava
{
1 => "Case 1",
2 => "Case 2",
3 => "Case 3",
4 => "Case 4",
_ => "No case availabe"
};
boolean result = switch(ternaryBool) {
case TRUE -> true;
case FALSE -> false;
case FILE_NOT_FOUND -> throw new UncheckedIOException(
"This is ridiculous!",
new FileNotFoundException());
// as we'll see in "Exhaustiveness", `default` is not necessary
default -> throw new IllegalArgumentException("Seriously?!");
};