Operators and Precedence

1.6 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

a.       Exponentiation

b.       Division and multiplication

c.       Integer division

d.       Modulo arithmetic

e.       Addition and subtraction

2.       Concatenation operators

3.       Logical operators

a.       Not

b.       And, AndAlso

c.       Or, OrElse

d.       X

If two or more operators in an expression have the same order of precedence, they are evaluated from left to right.

 



VB. NET Language Pocket Reference
VB.NET Language Pocket Reference
ISBN: 0596004281
EAN: 2147483647
Year: 2002
Pages: 31

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net