Operators and Precedence
VB supports the following operators:
Operator |
Description |
|
Addition, string concatenation |
|
Increment and assign |
|
Subtraction, unary operator |
|
Subtract and assign |
|
Division |
|
Divide and assign |
|
Integer division (no remainder) |
|
Integer division and assignment |
|
Modulo arithmetic |
|
Multiplication |
|
Multiply and assign |
|
Exponentiation |
|
Exponentiation and assignment |
|
String concatenation |
|
String concatenation and assignment |
|
Equality, assignment |
|
Equality (for object references) |
|
Less than |
|
Less than or equal to |
|
Greater than |
|
Greater than or equal to |
|
Not equal to |
|
Logical or bitwise conjunction |
|
Logical conjunction with short-circuiting |
|
Logical or bitwise disjunction |
|
Logical disjunction with short-circuiting |
|
Logical or bitwise negation |
|
Logical or bitwise exclusion |
Expressions are evaluated in the following order:
Arithmetic operators
Exponentiation
Division and multiplication
Integer division
Modulo arithmetic
Addition and subtraction
Concatenation operators
Logical operators
Not
And, AndAlso
Or, OrElse
X
If two or more operators in an expression have the same order of precedence, they are evaluated from left to right.
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.