Operator

# -

<div class="rst-class">

forsearch

</div>

\-

<div class="rst-class">

forsearch

</div>

Operator

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to find the difference between two numbers or to negate the sign of a number.

## Usage

``` xojo
result = expression1 - expression2
```

| Part        | Type   | Description                                             |
|-------------|--------|---------------------------------------------------------|
| result      | Number | The difference between *expression1* and *expression2*. |
| expression1 | Number | Any numeric expression.                                 |
| expression2 | Number | Any numeric expression.                                 |

**or**

``` xojo
result = -expression
```

| Part       | Type   | Description                          |
|------------|--------|--------------------------------------|
| result     | Number | *Expression* with the opposite sign. |
| expression | Number | Any numeric expression.              |

## Notes

You can use `Operator  Subtract</api/language/operators/operator_overloads/operator_subtract>` to define the subtraction operation for custom classes and `Operator Negate</api/language/operators/operator_overloads/operator_negate>` to define the negation operation.

## Sample code

This example stores the difference between two numbers in a variable:

``` xojo
Var diff As Integer
diff = 50 - 30 ' diff is 20
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Operator Subtract</api/language/operators/operator_overloads/operator_subtract>`, `Operator Negate</api/language/operators/operator_overloads/operator_negate>` functions; `Operator precedence</api/language/operators/operator_precedence>`

</div>
