|
Operators
|
||||||||||||||||||||||||
|
Programming languages have three types of operators: arithmetic, relational, and logical.
|
||||||||||||||||||||||||
|
Arithmetic
__________________________ Examples:
__________________________ Precedence of Arithmetic Operators If multiple arithmetic operators are included in a single equation, the operations are performed in a specific order:
__________________________
Parentheses can be used to clarify the precedence of operators in an expression, or even alter the precedence. Parentheses have a higher precedence than any operator. __________________________ Expression Type VB expressions have both a type and a value.
__________________________ Built-in Functions
|
||||||||||||||||||||||||
|
Relational
or Comparison
Operators
|
||||||||||||||||||||||||
|
Logical operators can be used to test multiple conditions by combining simple conditions. The logical operators are And, Or, and Not.
And and Or can only be used to test a complete condition. The following is an invalid statement:
Instead, a complete condition must be specified:
The same holds true for the And. The following is invalid: Similarly, you cannot write a VB statement like
The correct syntax for such a statement is If ( grade < 90 ) And ( grade >= 80 ) Then
See the note on the evaluation of compound conditions and short circuiting.... Additional operators
|
||||||||||||||||||||||||
|
Precedence of VB Operators
|