Vb.net Operators


Visual Basic comes with many built-in operators that allow us to manipulate data. An operator performs a function on one or more operands. For example, we add two variables with the “+” addition operator and store the result in a third variable with the “=” assignment operator like this: int x + int y = int z. The two variables (x ,y)¬†are called operands. There are¬†different types of operators in Visual Basic and they are described below in the order of their precedence.

Arithmetic Operators

Arithmetic operators are used to perform arithmetic operations that involve calculation of numeric values. The table below summarizes them:

Operator Use
^ Exponentiation
Negation (used to reverse the sign of the given value, exp -intValue)
* Multiplication
/ Division
\ Integer Division
Mod Modulus Arithmetic
+ Addition

Concatenation Operators

Concatenation operators join multiple strings into a single string. There are two concatenation operators, + and & as summarized below:

Operator Use
+ String Concatenation
& String Concatenation

Comparison Operators

A comparison operator compares operands and returns a logical value based on whether the comparison is true or not. The table below summarizes them:

Operator Use
= Equality
<> Inequality
< Less than
> Greater than
>= Greater than or equal to
<= Less than or equal to

Logical / Bitwise Operators

The logical operators compare Boolean expressions and return a Boolean result. In short, logical operators are expressions which return a true or false result over a conditional expression. The table below summarizes them:

Operator Use
Not Negation
And Conjunction
AndAlso Conjunction
Or Disjunction
OrElse Disjunction
Xor Disjunction

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

Your email address will not be published. Required fields are marked *


Time limit is exhausted. Please reload CAPTCHA.