• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Using Procedures to Customiz... > More than One Way to Handle Conditio...

More than One Way to Handle Conditions

Programs must be able to make decisions based on conditions. It is not unusual to be confronted with a task that involves what is called conditional processing, which is the ability to determine which direction to take the program based on a value or a set of conditions. If X value is true, then do Y. If it is false, then do Z. If Ralph has a grade point average of B or better, then put him in the scholarship program. If it is not equal to or better than B, then don’t put him in the scholarship program. These are the kinds of real-life situations that you can encounter. In short, you need to have the ability to control your program. You have already been introduced to the following flow control structures, now you have the opportunity to evaluate them by example.

If...Then...Else Construct

The If...Then...Else construct enables you to check a condition and, based on whether that condition is true, perform an operation or a set of operations. That condition can be a single value, a range of values, or a set of values linked together with operators such as AND or OR. Table 10.4 illustrates some examples.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint