Conditional logic is something that we apply all the time in our everyday lives. For example, based on the sale price of a particular item, you may decide either to put it back on the shelf or to purchase it. Likewise, based on how cold it feels when you wake up in the morning, you may decide whether to get up or sleep in late. There is really not anything different between this type of logic and the conditional logic that you'll learn to apply in your Visual Basic applications.
At the core of any conditional logic test is a determination as to whether the condition being tested is true or false. Based on the results of this analysis, different actions may be taken. To help facilitate the development of conditional logic, Visual Basic provides you with two different statements, each of which is suited to different situations. These statements are:
If…Then. This statement provides the ability to test a condition and then to alter the execution flow of your application based on the result of that test.
Select Case. This statement provides you with the ability to perform a number of tests against a single value and to perform one of a series of possible actions based on the result.