Operators - in COBOL and C# and VB.NET

C# COBOL VB.NET
Comparison
==  <  >  <=  >=  !=

Arithmetic
+  -  *  /
%  (mod)
/  (integer division if both operands are ints)
Math.Pow(x, y)

Assignment
=  +=  -=  *=  /=   %=  &=  |=  ^=  <<=  >>=  ++  --

Bitwise
&   |   ^   ~   <<   >>

Logical
&&   ||   &   |   ^   !

//Note: && and || perform short-circuit logical evaluations
String Concatenation
+
*> Comparison operators: 
*> = < > <= >= <>
 display (1 = 1) *> true  
 
 display (1 > 2) *> false

 display (1 < 2) *> true 
 
 display (1 <= 1) *> true 
 
 display (1 >= 2) *> false
 
 display (0 <> 1) *> true
 
 
 
*> Arithmetic operators, 
*> * / + - **

 display ( (5 + 1) * (5 - 1) ) *> result 24
 display ( 2 ** 3 ) *> result 8
 display ( function mod (5 3) ) *> result 2
 
*> Local variable declarations
 declare a, b, c as binary-long
 declare d = "I'm a string" *> string type inferred from value

*> Assignment statements 
*> move, set, compute
 set a = 1 
 move 2 to b 
 compute c = 3 * 6
 set a = 3 * 6

*> Type operator
 declare mystr as string = "string"
 declare myobj as object = mystr
 display (myobj instance of string) *> true

*> Bitwise
*> b-and, b-or, b-xor, b-not, b-left, b-right
 display (4 b-and 3) 
 display (4 b-or 3) 
 display (b-not 3)
 display (4 b-xor 3) 
 display (4 b-left 1) *> shift left one place
 display (4 b-right 2) *> shift right two places

*> Logical
*> and, or, not

 display (true and false) *> false
 display (true or false) *> true
 display (not true) *> false
Comparison
=  <  >  <=  >=  <>

Arithmetic
+  -  *  /
Mod
\  (integer division)
^  (raise to a power)

Assignment
=  +=  -=  *=  /=  \=  ^=  <<=  >>=  &=

Bitwise
And   Or   Xor   Not   <<   >>

Logical
AndAlso   OrElse   And   Or   Xor   Not

'Note: AndAlso and OrElse perform short-circuit logical evaluations
String Concatenation
&