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

Mod

Modulo arithmetic

*

Multiplication

*=

Multiply and assign

^

Exponentiation

^=

Exponentiation and assignment

&

String concatenation

&=

String concatenation and assignment

=

Equality, assignment

Is

Equality (for object references)

<

Less than

<=, =<

Less than or equal to

>

Greater than

>=, =>

Greater than or equal to

<>, ><

Not equal to

And

Logical or bitwise conjunction

AndAlso

Logical conjunction with short-circuiting

Or

Logical or bitwise disjunction

OrElse

Logical disjunction with short-circuiting

Not

Logical or bitwise negation

Xor

Logical or bitwise exclusion

Expressions are evaluated in the following order:

  1. Arithmetic operators

    1. Exponentiation

    2. Division and multiplication

    3. Integer division

    4. Modulo arithmetic

    5. Addition and subtraction

  2. Concatenation operators

  3. Logical operators

    1. Not

    2. And, AndAlso

    3. Or, OrElse

    4. 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.