d
Size: a a a
d
Ln
d
Ln
Т8
V
DB
V
KF
Т8
Т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?!");
};
DB
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?!");
};
AM
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?!");
};
AM
NK
AM
Т8
var delegateReturn = delegate int (int param1) {
return 42 + param1;
};
Т8
Т8
var delegateReturn = delegate int (int param1) {
return 42 + param1;
};
F
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?!");
};
var operation = 2;
var result = switch(operation) {
case 1 -> "Case 1";
case 2 -> "Case 2";
case 3 -> "Case 3";
case 4 -> "Case 4";
default -> "No case available";
}