O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix C. Operators

There are four groups of operators in VB.NET: arithmetic, concatenation, comparison, and logical. We will look at each group of operators in turn before discussing the order of precedence VB.NET uses when it encounters more than one type of operator within an expression.

Arithmetic Operators

The arithmetic operators are:

+

The addition operator. Used to add numeric expressions, as well as to concatenate (join together) two string variables. However, it is preferable to use the concatenation operator with strings to eliminate ambiguity. For example:

                        result = expression1 + expression2
-

The subtraction operator. Used to find the difference between two numeric values or expressions, as well as to denote a negative value. Unlike the addition operator, it cannot be used with string variables. For example:

                        result = expression1 - expression2
/

The division operator. Returns a floating point number. For example:

                        result = expression1 / expression2
*

The multiplication operator. Used to multiply two numerical values. For example:

                        result = expression1 * expression2
\

The integer division operator. Performs division on two numeric expressions and returns an integer result (no remainder or decimal places). For example:

                        result = expression1 \ expression2

Note that regardless of what specific numeric data types expression1 and expression2 are, integer division returns only an integral data type (Byte, Short, Integer, or Long). After the division is performed, the result ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required