Operators

Click here to load reader

download Operators

of 25

description

This Presentation has the details about the Operators in VB.NET..

Transcript of Operators

  • 1. Operators in VB.NET
    www.ustudy.in

2. Introduction
Operator is defined as a symbol that operates the variables and constants to produce a required result.
www.ustudy.in
3. VB.NET Operators
Arithmetic operators
Comparison operators
Logical operators
Concatenation operators
www.ustudy.in
4. Arithmetic operators
Arithmetic operators are used to perform arithmetic calculations such as addition and subtraction.
VB.NET supported arithmetic are listed in the given table.
www.ustudy.in
5. www.ustudy.in
6. Comparison operators
Comparison operators are used to compare two or more values.
VB.NET supported comparison operators are listed in the following table.
www.ustudy.in
7. www.ustudy.in
8. Logical operators
Logical operators are used to perform logical operations such as AND, OR, NOT on one or more expressions.
www.ustudy.in
9. AND
This operator is used as a conjunction of two conditions. The result of the AND operation is True only if both the conditions are true.
Syntax:
Result = Expression1 AND Expression2
www.ustudy.in
10. Result of AND operation table
www.ustudy.in
11. Example of AND Operator
Dim a, b, c As Integer
Dim d As Boolean
a = 10
b = 20
c = 30
d = (ad = (a>b) AND (bwww.ustudy.in
12. OR
This operator is used as a disjunction of two conditions. The result of the OR operator is false only if both the conditions are false.
Syntax:
Result = Expression1 OR Expression2
www.ustudy.in
13. Result of OR operation table
www.ustudy.in
14. Example of OR Operator
Dim a, b, c As Integer
Dim d As Boolean
a = 10
b = 20
c = 30
d = (ac)Returns True
d = (a>b) OR (b>c)Returns False
www.ustudy.in
15. XOR
The result this operator is True only if one of the conditions is true and other is false.
Syntax:
Result = Expression1 XOR Expression2
www.ustudy.in
16. Result of XOR operation table
www.ustudy.in
17. Example of XOR Operator
Dim a, b, c As Integer
Dim d As Boolean
a = 10
b = 20
c = 30
d = (ad = (a>b) XOR (bwww.ustudy.in
18. NOT
This logical operator is used to perform a logical negation on a boolean expression.
Syntax:
Result = NOT (boolean Expression)
www.ustudy.in
19. Result of NOT operation table
www.ustudy.in
20. Example of XOR Operator
Dim a, b, c As Integer
Dim d As Boolean
a = 10
b = 20
c = NOT (a>b)Returns True
c = NOT (awww.ustudy.in
21. AndAlso
This operator is same as AND operator but if the first condition is false then the second condition is not checked and the result is false.
Syntax:
Result = Expression 1 AndAlso Expression2
www.ustudy.in
22. OrElse
This operator is same as OR operator but if the first condition is true then the second condition is not checked and the result is True.
Syntax:
Result = Expression 1 OrElse Expression2
www.ustudy.in
23. Concatenation operators
Concatenation operators are used to join two string values.
& and + are the two concatenation operators available in VB.NET.
The operator & is used to concatenate two strings and + is used to add two numbers and concatenate two strings.
www.ustudy.in
24. Example of concatenation operators
MsgBox(Good & Night)Returns GoodNight
MsgBox(Good + Night)Returns GoodNight
MsgBox(22 & 33)Returns 2233
MsgBox(22 + 33)Returns 2233
MsgBox(22 + 33)Returns 55
www.ustudy.in
25. The End
.. Thank You
www.ustudy.in