in reply to Fixing cascading if-elsif-else statements
Consider a dispatch table.
See, especially, replies to elsif chain vs. dispatch and (node) Re: replace conditionals with polymorphism.