Switch Statement to the Rescue

How does this even work?