Quote:
Originally Posted by grumpy
Depends on your definition of "neat", I guess. Given that some of the conditions involve the value of "key" being in a range, that means a switch/case approach must list all the cases in that range. That can easily become unwieldy and difficult to maintain (eg it is easy to leave out one of the cases and that is hard to pick up without quite comprehensive testing).
|
You could create an if block for the ranges, and put the single keys in a switch. Not sure if that would look neater, though.