Decision structures (Visual Basic)
Visual Basic allows testing conditions and perform different operations depending on the test results. You can check whether a condition is true or false, the different values of an expression or the various exceptions that are generated by executing a series of instructions.
Undertake different actions when the value of a condition is true and when it is false.
Construction If ... Then ... Else
The If ... Then ... Else constructs allow you to test one or more conditions and execute one or more instructions on a per condition. You can test conditions and take action in the following ways:
- Run one or more instructions if a condition is True.
- Run one or more instructions if a condition is False.
- Run some instructions if a condition is True and False if other.
- Try an additional condition if a previous condition is False.
Select ... Case Construction
The Select ... Case construction evaluates an expression once and run different sets of possible values based on different instructions.