Skip to main content

Practice · 4 of 5

Menu dispatch with a switch expression

CHALLENGE
Difficulty: beginner+25 XP

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.

Back to lesson: Practice: Practice: Decisions