previous |
start |
next
Multiple Alternatives
- In some cases, the order of the tests is
important.
- Example: A program that displays a description
of the likely impact of an earthquake based on its magnitude on the
Richter scale.
- Note that the order of the tests ensures that
the right results are printed (see following code).
- Note that the if/else/else structure ensure the
alternatives are exclusive. Independent if statements may cause a
single input to print several messages.
previous |
start |
next