VB.NET Operators
- An Operator is a symbol that is used to perform various operations on variables.
- VB.NET has different types of Operators that help in performing logical and mathematical
operations on data values.
- The Operator precedence is used to determine the execution order of different Operators in
the VB.NET programming language.
What is VB.NET Operator?
- In VB.NET, operator is a special symbol that tells the compiler to perform the specific logical
or mathematical operation on the data values.
- The data value itself (which can be either a variable or a constant) is called an operand, and
the Operator performs various operations on the operand.
For example: In the expression below,
3+2-1
The symbol + and - are the Operators, and the 3, 2, and 1 are operands.
Different Types of VB.NET Operators
- VB.NET supports the following different types of Operators:-
a) Arithmetic Operators
b) Comparison Operators
c) Logical and Bitwise Operators
d) Bit Shift Operators
e) Assignment Operators
f) Concatenation Operators
g) Miscellaneous Operators
a) Arithmetic Operators
- The Arithmetic Operators in VB.NET, are used to perform mathematical operations such
as subtraction, addition, multiplication, division, etc. on the operands.
- These are as follows:
Arithmetic Operators in VB.NET
Operators Description Example
It is an exponentiation Operator that is used to raise one
^ Y ^ X (X to the power Y)
operand to the power of another operand.
The addition Operator is used to add numeric data, as well
+ X+Y
as concatenate two string variables.
It is a subtraction Operator, which is used to subtract the
- X-Y
second operand from the first operand.
, The multiplication Operator is used to multiply the
* X*Y
operands
It is a division Operator used to divide one operand by
/ X/Y
another operand and returns a floating-point result.
It is an integer division Operator, which is similar to
\ division Operator, except that it returns an integer result X\Y
while dividing one operand to another operand.
It is a modulo (Modulus) Operator, which is used to divide
Mod X Mod Y
two operands and returns only a remainder.
b) Comparison Operators
- The Comparison Operators are used to compare the value of two variables or operands for
the various condition such as greater, less than or equal, etc. and returns a Boolean value
either true or false based on the condition.
Operator Description Example
It checks whether the value of the two operands is
= equal; If yes, it returns a true value, otherwise it shows (A = B)
False.
It is a Non-Equality Operator that checks whether the
<> value of the two operands is not equal; it returns true; (A <> B), check Non-Equality
otherwise, it shows false.
A greater than symbol or Operator is used to determine
whether the value of the left operand is greater than the (A > B); if yes, TRUE,
>
value of the right operand; If the condition is true, it Else FALSE
returns TRUE; otherwise, it shows FALSE value.
It is a less than symbol which checks whether the value
of the left operand is less than the value of the right (A < B); if the condition is true,
<
operand; If the condition is true, it returns TRUE; returns TRUE else FALSE
otherwise, it shows FALSE value.
It is greater than equal to which checks two conditions
whether the first operand is greater than or equal to the
>= A >= B
second operand; if yes, it returns TRUE; otherwise, it
shows False.
This symbol represents less than equal to which
determines the first operand is less than or equal to the
<= A <= B
second operand, and if the condition is true, it returns
TRUE; otherwise, it shows FALSE.
- An Operator is a symbol that is used to perform various operations on variables.
- VB.NET has different types of Operators that help in performing logical and mathematical
operations on data values.
- The Operator precedence is used to determine the execution order of different Operators in
the VB.NET programming language.
What is VB.NET Operator?
- In VB.NET, operator is a special symbol that tells the compiler to perform the specific logical
or mathematical operation on the data values.
- The data value itself (which can be either a variable or a constant) is called an operand, and
the Operator performs various operations on the operand.
For example: In the expression below,
3+2-1
The symbol + and - are the Operators, and the 3, 2, and 1 are operands.
Different Types of VB.NET Operators
- VB.NET supports the following different types of Operators:-
a) Arithmetic Operators
b) Comparison Operators
c) Logical and Bitwise Operators
d) Bit Shift Operators
e) Assignment Operators
f) Concatenation Operators
g) Miscellaneous Operators
a) Arithmetic Operators
- The Arithmetic Operators in VB.NET, are used to perform mathematical operations such
as subtraction, addition, multiplication, division, etc. on the operands.
- These are as follows:
Arithmetic Operators in VB.NET
Operators Description Example
It is an exponentiation Operator that is used to raise one
^ Y ^ X (X to the power Y)
operand to the power of another operand.
The addition Operator is used to add numeric data, as well
+ X+Y
as concatenate two string variables.
It is a subtraction Operator, which is used to subtract the
- X-Y
second operand from the first operand.
, The multiplication Operator is used to multiply the
* X*Y
operands
It is a division Operator used to divide one operand by
/ X/Y
another operand and returns a floating-point result.
It is an integer division Operator, which is similar to
\ division Operator, except that it returns an integer result X\Y
while dividing one operand to another operand.
It is a modulo (Modulus) Operator, which is used to divide
Mod X Mod Y
two operands and returns only a remainder.
b) Comparison Operators
- The Comparison Operators are used to compare the value of two variables or operands for
the various condition such as greater, less than or equal, etc. and returns a Boolean value
either true or false based on the condition.
Operator Description Example
It checks whether the value of the two operands is
= equal; If yes, it returns a true value, otherwise it shows (A = B)
False.
It is a Non-Equality Operator that checks whether the
<> value of the two operands is not equal; it returns true; (A <> B), check Non-Equality
otherwise, it shows false.
A greater than symbol or Operator is used to determine
whether the value of the left operand is greater than the (A > B); if yes, TRUE,
>
value of the right operand; If the condition is true, it Else FALSE
returns TRUE; otherwise, it shows FALSE value.
It is a less than symbol which checks whether the value
of the left operand is less than the value of the right (A < B); if the condition is true,
<
operand; If the condition is true, it returns TRUE; returns TRUE else FALSE
otherwise, it shows FALSE value.
It is greater than equal to which checks two conditions
whether the first operand is greater than or equal to the
>= A >= B
second operand; if yes, it returns TRUE; otherwise, it
shows False.
This symbol represents less than equal to which
determines the first operand is less than or equal to the
<= A <= B
second operand, and if the condition is true, it returns
TRUE; otherwise, it shows FALSE.