Can the if and let statements above be combined into a single match statement?