Operator (s) in Visual Basic 2010 (VB.NET)

Operators are elements in a code that hold an operation on either one or more than one values (variables and constants). Operators are the actual functioning parts of the codes. Although; a program can be written without the use of operators, making use of operators in programs make them more functional and operative.

Types of Operators in Visual Basic. Net

Visual Basic. Net is very rich in built-in operators and supports the following types of operators:

Arithmetic Operators:




Arithmetic Operators are used to carry on arithmetic operations such as addition, subtraction, division and multiplication. Besides these operations it also holds operations such as exponentiation, mod, integer division and etc. The difference between division and integer division is that in simple division, the answer is evaluated up to six digit after the decimal point. While in integer division only the integer part of the answer is evaluated and the decimal part is ignored.

The following table explains you the list of arithmetic operators used in VB.Net:

Arithmetic Operators

Example Code: (In combination with ByVal = Pass By Value)

Output:

output 8

 

 

 

 

 

 

 

 

Check Also: Math Operators in VB.NET

String Concatenation Operators:




String concatenation or simply the concatenation operators are used to concatenate or join values (variables and constants) together to form one bigger string. The two main operators used here are the (+) and (&) operators. They are both used to join values together.

The main difference between these two operators is that; (+) can be used to join not only string/ character values but also numeric values while (&) can only be used to join string/ character values.

The following table explains you the list of string concatenation operators used in VB.Net:

String Concatenation Operators

Example Code:

Output:

Output 1Output 2

 

 

 

 

 

Relational/ Comparison Operators:




Relational or comparison operators are those operators which are used to compare two values and based on the result, generate an output. These two values can be variables, strings, or objects. Every relational operation results in a Boolean value. This Boolean value can be either TRUE or FALSE.

The following table explains you the list of relational/ comparison operators used in VB.Net:

Relational Operators

Example Code:

Output:

Output 5Output 6

 

 

 

 

 

 

 

 

Check Also: Operators Used in PHP

Logical Operators:




Logical operators are generally used to combine two or more conditions and evaluate them together. Logical operators are sometimes called as the Bitwise operators, too.

The following table explains you the list of logical operators used in VB.Net:

Logical Operators

Example Code:

Output:

Output 3Output 4

 

 

 

 

 

 

 

 

 

Related: Top 10 Programming Languages to Learn in 2017

Operator Precedence




A VB.Net line of code may have more than one operators in it. In such cases, VB.Net evaluates which operator to carry first. This concept is called the operator precedence. Operator Precedence determines which operation has to be evaluated first and which one last.

The table below shows the precedence of operators used in VB.Net:

Operators Precedence

Feel free to post your comments and ask us for further tutorials.

 

Comments

  • Leave a Reply

    %d bloggers like this: