private static void IssueCommand(Robot robot, string commandInput) { foreach (var command in commandInput) { switch (command) { case 'L': robot.TurnLeft(); break; case 'R': robot.TurnRight(); break; case 'M': robot.Move(); break; default: throw new UnknownCommandException(command); } } }