## Notes - Switch expressions ## Switch Expressions Using lambdas, can return a value from a switch statement ```java @Test public void myFunction { var me = 4; var operation = "squareMe"; var result = switch (operation) -> { case "doubleMe" -> { yield me * 2; } case "squareMe" -> { yield me * me; } default -> me; } assertEquals(16, result); } ``` ## Text Blocks ```java // before String JSON_STRING = "{\r\n" + "\"name\" : \"Baeldung\"" + "}"; // after String TEXT_BLOCK = """ { "name": "Baeldung" } """; ```