operator is a symbol (e.g.,
&) that causes VB.NET to take an action. That
action might be an assignment of a value to a variable, the addition
of two values, a comparison of two values, concatenation of strings,
In the previous sections, you’ve seen a number of
operators at work. For example, the
assignment operator (
has been used to assign a value to a variable:
Dim myVariable As Integer myVariable = 15
In the code shown above, the value 15 is assigned to the Integer
variable myVariable. In the section on branching you saw more
sophisticated operators, such as the greater-than
>) used to compare two values:
If valueOne > valueTwo Then
If statement compares valueOne with
valueTwo; if the former is larger than the latter, the test evaluates
true, and the
If statement executes.
The following sections will consider many of the operators used in VB.NET in some detail.
uses seven mathematical operators: five for standard calculations
\), a sixth to return
the remainder when dividing integers (
Mod), and a
seventh for exponential operations (
following sections consider the use of these operators.
VB.NET offers five operators for
simple arithmetic: the
-), and multiplication
*) operators work as you might expect. Adding two numbers returns their sum, subtracting returns their difference, and ...