Conditional logic decides which action to take based on user input, external conditions or other information. All conditional logic starts with a condition: a simple expression that can be evaluated to True or False.
To build a condition, you can use any combination of literal values or variables along with logical operators. Following table lists the basic logical operators.
|<>||Not equal to.|
|<=||Less than or equal to.|
|>=||Greater than or equal to.|
|And||Logical and (evaluates to True only if both expressions are True).|
|AndAlso||Similar to And, but it doesn’t evaluate the second expression if the first one is
False. This is a useful approach if evaluating the second option would be time
consuming or could cause an error if the first condition is False.
|Or||Logical or (evaluates to True if either expression is True).|
|OrElse||Similar to Or, but it doesn’t evaluate the second expression if the first one is True.
This is a useful approach if evaluating the second option would be time-consuming or
could cause an error if the first condition is True.
You can use the comparison operators (<, >, <=, >=) with numeric types and with strings. A string is deemed to be “less than” another string if it occurs earlier in an alphabetic sort. Thus “apple” is less than “attach.”