Visual Basic Flow Control
In Visual Basic Comparison and Logic we looked at how to use Visual Basic logical expressions to decide is something is True or False. Much of the art of programming involves writing code that makes decisions based on one or more criteria. Such decisions define which code gets executed and which code gets by-passed when the application is running. This is often referred to as flow control since it controls the flow of execution.
In previous chapters the If statement has been widely used in examples. In this chapter of Visual Basic Essentials we are going to cover the various forms of If statements such as If .. Then .. Else, together with other decision making code structures such as Select Case and GoTo
Using If ... Then to Make Decisions
The If ... Then construct is probably the most common decision making tool used by Visual Basic programmers. teh basic syntax of this decision structure is as follows:
If expression Then
.. Code to be Executed ..
Endif