Export (0) Print
Expand All

Operators Compared in Different Languages 

This topic lists the operators for Visual Basic, Visual J#, C++, C#, JScript, and Visual FoxPro.

For details about operators in this language See

Visual Basic

Operators Summary

C++

C++ Operators

User-Defined Operators

C#

C# Operators

JScript

JScript Operators

  Visual Basic Visual J# C++ C# JScript Visual FoxPro

Additive

 

 

 

 

 

 

  Addition

+

+

+

+

+

+

  Subtraction

-

-

-

-

-

-

Multiplicative

 

 

 

 

 

 

  Multiplication

*

*

*

*

*

*

  Division

/

/

/

/

/

/

  Integer division

\

/1

/1

/1

 

 

  Modulus division (returning only the remainder)

Mod (also works with floating point)

%

%

%

% (also works with floating point)

%

Mod

  Exponentiation

^

n/a

n/a

n/a

n/a

^ **

Assignment

 

 

 

 

 

 

  Assignment

=

=

=

=

=

=

  Addition

+=

+=

+=

+=

+=

+

  Subtraction

-=

-=

-=

-=

-=

-

  Multiplication

*=

*=

*=

*=

*=

*

  Division

/=

/=

/=

/=

/=

/

  Integer division

\=

n/a

n/a

/=1

n/a

n/a

  String concatenation

&=

+=

+=

+=

+=

+

-

$

  Modulus division

n/a

%=

%=

%=

%=

%

  Left shift

<<=

<<=

<<=

<<=

<<=

BITLSHIFT( )

  Right shift

>>=

>>=

>>=

>>=

>>=

BITRSHIFT( )

  Bitwise AND

n/a

&=

&=

&=

&=

BITAND( )

  Bitwise exclusive OR

n/a

^=

^=

^=

^=

BITXOR( )

  Bitwise inclusive OR

n/a

|=

|=

|=

|=

BITOR( )

Null coalescing

n/a

n/a

n/a

??

n/a

n/a

Relational and equality

 

 

 

 

 

 

  Less than

<

<

<

<

<

<

  Less than or equal to

<=

<=

<=

<=

<=

<=

  Greater than

>

>

>

>

>

>

  Greater than or equal to

>=

>=

>=

>=

>=

>=

  Equal

=

==

==

==

==

=

  Not equal

<>

!=

!=

!=

!=

<>

#

!=

  Reference variable comparison

Is

IsNot

==

n/a

==

==

COMPOBJ( )

  Reference type comparison

TypeOf x Is Class1

x instanceof Class1

n/a

x is Class1 (also see as and typeof)

instanceof

n/a

  String comparison

StrComp( )

java.lang.String.equalsIgnoreCase(String str)

(There are functions to compare and concatenate strings)

==

Equals

==

=

  CString concatenation

&

+

 

+

+

+

  Short circuited Boolean AND

AndAlso

&&

&&

&&

&&

AND

.AND.

  Short circuited Boolean OR

OrElse

||

||

||

||

n/a

Bit shift

 

 

 

 

 

 

  Left shift

<<

<<

<<

<<

<<

n/a

  Right shift

>>

>>

>>

>>

>>

>>>

n/a

Scope resolution

 

 

 

 

 

 

  Scope resolution

.

MyBase

MyClass

.

::

.

base

n/a

::

Postfix 2

 

 

 

 

 

 

  Array element

( )

[ ]

[ ]

[ ]

[ ]

[ ]

( )

  Function call

( )

( )

( )

( )

( )

( )

  Type cast or conversion

CInt

CDbl

...

CType

(type)

(type)

(type)

type( )

n/a

  Member selection

.

!

.

.

->

.

.

.

  Postfix increment

n/a

++

++

++

++

n/a

  Postfix decrement

n/a

--

--

--

--

n/a

Unary 3

 

 

 

 

 

 

  Indirection

n/a

n/a

*

* (unsafe mode only)

n/a

n/a

  Address of

AddressOf

n/a

&

& (unsafe mode only; also see fixed)

n/a

n/a

  Logical NOT

Not

!

!

!

!

!

NOT

.NOT.

  One's complement

Not

~

~

~

~

BITNOT( )

  Prefix increment

n/a

++

++

++

++

n/a

  Prefix decrement

n/a

--

--

--

--

n/a

  Size of type

n/a

n/a

sizeof

sizeof

n/a

n/a

  Comma

n/a

,

,

n/a

,

n/a

Bitwise

 

 

 

 

 

 

  Bitwise AND

And

&

&

&

&

BITAND( )

  Bitwise exclusive OR

Xor

^

^

^

^

BITXOR( )

  Bitwise inclusive OR

Or

|

|

|

|

BITOR( )

Logical

 

 

 

 

 

 

  Logical AND

And

&&

&

&

&&

AND

.AND.

  Logical OR

Or

||

|

|

||

OR

.OR.

Conditional

 

 

 

 

 

 

  Ternary conditional

IIf( )

?:

?:

?:

?:

n/a

Pointer to member

 

 

 

 

 

 

  Pointer to member

n/a

n/a

.* ->

. (Unsafe mode only)

n/a

n/a

Reference

 

 

 

 

 

 

  Reference

n/a

n/a

&

n/a (use reference types)

n/a

@

1. The division operator is overloaded to handle both integer and floating-point division, depending on the operands.

2. Postfix operators have the highest order of precedence in expression evaluation.

3. Unary operators appear before the operand and associate from right to left.

Community Additions

ADD
Show:
© 2015 Microsoft