Skip to main content

Practice ยท 4 of 5

Menu dispatch with a switch expression

Implement String dispatch(String command) using a **switch expression** (arrow form): "start" โ†’ "running", "stop" โ†’ "stopped", "pause" โ†’ "paused", and any other command โ†’ "unknown: " plus the command itself.

Difficulty: beginner

Back to lesson: Practice: Practice: Decisions