Important | This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer |

# - Operator (Visual Basic)

**Visual Studio 2005**

Returns the difference between two numeric expressions or the negative value of a numeric expression.

expression1 – expression2 - or - – expression1

The result is the difference between expression1 and expression2, or the negated value of expression1.

The result data type is a numeric type appropriate for the data types of expression1 and expression2. See the "Integer Arithmetic" tables in Data Types of Operator Results.

In the first usage shown in the preceding syntax, the **–** operator is the *binary* arithmetic subtraction operator for the difference between two numeric expressions.

In the second usage shown in the preceding syntax, the **–** operator is the *unary* negation operator for the negative value of an expression. In this sense, the negation consists of reversing the sign of expression1, so the result is positive if expression1 is negative.

If either expression evaluates to Nothing, the **–** operator treats it as zero.

Note |
---|

The |

The following example uses the **–** operator to calculate and return the difference between two numbers, and then to negate a number.

Dim binaryResult As Double = 459.35 - 334.9 Dim unaryResult As Double = -334.9

Following the execution of these statements, `binaryResult` contains 124.45 and `unaryResult` contains –334.90.