Is there a switch case extension instead of numerous if/then/else?

How many if/then/else variants?

If there are so many, maybe what you needed was a table or dictionary lookup.

See the question/answer/score table in How do I program multiple choice questions that include different text for each wrong answer.
Because the score per answer is part of the table, there is no need for an if/then test to decide to add to a score or not, since the score increment is built into the table structure.

This is called table oriented programming.

1 Like