Just a nitpick but FWIW I feel like it might make this a little easier to understand this construct if you create a named array outside the `if` statement....or just use a `switch` statement?

Either way your approach is still pretty neat!