HP C/iX Reference Manual (31506-90011)
86 Chapter6
Statements
The if Statement
The tests are each executed in order until successful or until the end of the selection
statement is reached. In the previous example, if a is equal to d, all three comparisons
would be executed. On the other hand, if a is equal to c, only the first two comparisons are
executed. Therefore, conditions that are most likely to be true should be tested first in an
else-if chain. The switch statement, however, may execute only one comparison
(depending on efficiency tradeoffs). Use the switch statement where possible to make a
program more readable and efficient (See "The switch Statement" below).