August 2003
Beginner
600 pages
12h 55m
English
At times, the if construct isn't capable of handling a decision situation without a lot of extra work. One such situation is when you need to perform different actions based on numerous possible values of an expression, not just true or false. For instance, suppose that you wanted to perform actions based on a user's profession. The following shows what you might create using if:
if (strProfession =="programmer") ... else if (strProfession =="teacher") ... else if (strProfession =="accountant") ... else ...
As you can see, this structure can be a bit hard to read. If the number of supported professions increases, this type of construction will get harder to read and debug. In addition, ...
Read now
Unlock full access