Control Flow in Java
`if`/`else`, `switch`, `for`, enhanced `for`, `while`, `do-while`, `break`, `continue`.
Beginner
Modern switch expressions:
String size = switch (n) { case 1, 2 -> "small"; case 3 -> "medium"; default -> "large"; };
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.