Wednesday, January 9, 2013

Visuel Basic :Operators

Operators:

Mathematical and Text operators

OperatorDefinition Example Result 
Exponent (power of) 4 ^ 2 16 
Multiply 5 * 4 20 
Divide 20 / 4 
Add 3 + 4 
Subtract 7 - 3 
Mod Remainder of division 20 Mod 6 
Integer division 20 \ 6 
String concatenation "Joan" & " " & "Smith" "Joan Smith" 


Note that the order of operators is determined by the usual rules in programming. When a statement includes multiple operations the order of operations is:
Parentheses ( ), ^, *, /, \, Mod, +, -

Logical operators

Operator Definition Example Result 
Equal to 9 = 11 False 
Greater than 11 > 9 True 
Less than 11 < 9 False 
>= Greater or equal 15 >= 15 True 
<= Less or equal 9 <= 15 True 
<> Not equal 9 <> 9 False 
AND Logical AND (9 = 9) AND (7 = 6) False 
OR Logical OR (9 = 9) OR (7 = 6) True

0 comments:

Post a Comment

Powered by Blogger.