Operator - (Subtract)
Subtracts two expressions
Syntax
`
Declare Operator - ( ByRef lhs As Byte, ByRef rhs As Byte ) As Byte
Declare Operator - ( ByRef lhs As UByte, ByRef rhs As UByte ) As UByte
Declare Operator - ( ByRef lhs As Short, ByRef rhs As Short ) As Short
Declare Operator - ( ByRef lhs As UShort, ByRef rhs As UShort ) As UShort
Declare Operator - ( ByRef lhs As Integer, ByRef rhs As Integer ) As Integer
Declare Operator - ( ByRef lhs As UInteger, ByRef rhs As UInteger ) As UInteger
Declare Operator - ( ByRef lhs As LongInt, ByRef rhs As LongInt ) As LongInt
Declare Operator - ( ByRef lhs As ULongInt, ByRef rhs As ULongInt ) As ULongInt
Declare Operator - ( ByRef lhs As Single, ByRef rhs As Single ) As Single
Declare Operator - ( ByRef lhs As Double, ByRef rhs As Double ) As Double
Declare Operator - ( ByRef lhs As T Pointer, ByRef rhs As T Pointer ) As Integer
Declare Operator - ( ByRef lhs As T, ByRef rhs As T ) As Integer
Declare Operator - ( ByRef lhs As T, ByRef rhs As Integer ) As T
Declare Operator - ( ByRef lhs As Integer, ByRef rhs As T ) As T
`
Usage
`
result = lhs` -`rhs
`
Parameters
`lhs`
The left-hand side expression to subtract from.
`rhs`
The right-hand side expression to subtract.
`T`
Any pointer type.
Return Value
Returns the subtraction of two expressions.
Description
When the left and right-hand side expressions are numeric values, `Operator -` (Subtract) returns the subtraction of the two values.
If the left and right-hand side expressions are both of the `T Pointer` type, for some type `T`, the operator performs pointer subtraction on the address, returning the result. This is different from numeric subtraction because the difference is divided by `SizeOf( T )`.
Neither operand is modified in any way.
This operator can be overloaded to accept user-defined types.
Example
`
Dim n As Single
n = 4 - 5
Print n
`
will produce the output:

    -1

Dialect Differences

- In the -lang qb dialect, this operator cannot be overloaded.

Differences from QB

- None

See also

- Mathematical Functions