Syntax with arrows from java 12 is still supported with yield. private static int getText(String mode) {
int result = switch (mode) {
case "a", "b" -> 1;
case "d", "e", "f" -> {
// do something here...
System.out.println("Supports multi line block!");
yield 3;
}
default -> -1;
};
return result;
}