Your now deleted question basically a large block of code. And you stated "I want to rewrite it to use a switch
. I've written something..."
But that doesn't seem to work that well...
The last line of your question is the key. You don't have working code.
Yes, someone commented to you suggesting Code Review but the exact comment is:
If this is working code you might want to post to Code Review instead.
You don't have working code, so you shouldn't have posted the question to Code Review. Code Review has very specific requirements for questions on the site. From that linked question:
In a nutshell:
- Real code has to be written.
- The code has to work.
- Broken code or troubleshoot bugs is off-topic.
- Requests to explain others' code are off-topic.
When another user makes a suggestion for another site, that doesn't mean copy and paste the question to it. Read what is on-topic before posting a question to make sure your question fits into the guidelines.
Now for your question on SO, it was put on hold as "unclear what you are asking." Before deleting and moving it, you could try to make this on-topic for SO. Shorten the question to include your switch and explain "why it doesn't work well". Make some improvements to the question, here, to try and make it on-topic for the site.