Worked example
enum Size { S, M, L }
Size sz = Size.M;
int ml = switch (sz) {
case S -> 250;
case M -> 500;
case L -> {
int base = 500;
yield base + 250; // block branch produces its value with yield
}
};
System.out.println(ml); // 500
All three constants are covered, so no default is required. The L branch uses a block and yield.