Programming Logic: Execute code based on conditions.
VB lets you execute code based on conditions.
To test a condition you use the if statement. The if statement returns true or false, based on your test:
An if statement can include an else condition.
The else condition defines the code to be executed if the condition is false.
Note: In the example above, if the first condition is true, it will be executed. The else condition covers "everything else".
Multiple conditions can be tested with an else if condition:
In the example above, if the first condition is true, it will be executed.
If not, then if the next condition is true, this condition will be executed.
You can have any number of else if conditions.
If none of the if or else if conditions are true, the last else block (without a condition) covers "everything else".
A select block can be used to test a number of individual conditions:
"Select Case" is followed by the test value (day). Each individual test condition has a case value, and any number of code lines. If the test value matches the case value, the code lines are executed.
A select block can have a default case (Case Else) for "everything else" that runs if none of the other cases are true.