Chapter 11. Making Decisions

You will learn the following in this chapter:

  • How decision making is accomplished in programs

  • How to use If-Then-Else statements

  • How to make multiple decisions by using ElseIf

  • How to use the Select Case statement

  • How to make your code more readable by using enumerations

  • How to use the short-circuit operators

It is the computer's capability to make decisions that makes it useful. A computer program can measure data and make comparisons, and from those comparisons, the program can make decisions based on the data that is available to it. It's not that the computer can do something you and I can't do. However, the computer can do things much faster than we can. You and I can go through 100,000 files one-by-one and say, "Nope, that's not the one," and keep right on looking. Days later, we might find the name we are looking for and then proceed to the next step. What would take us days to accomplish the computer can accomplish in seconds. Like humans , the computer can say, "Nope, that's not the one," but it can do it thousands of times a second. Better still, it doesn't get bored, it doesn't get eye strain or headaches , and if the computer is properly programmed, it doesn't make mistakes. Even if the decision is a simple yes or no, being able to do it thousands of times a second is pretty powerful stuff.

This chapter explores some of the ways in which a program can make decisions. You have learned about the If statement in earlier chapters. You have not, however, seen the complete picture. In this chapter we dig into the details of how you can harness that the computer's power.

Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: