-

From Xojo Documentation

Revision as of 23:28, 20 November 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Operator

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

Usage

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

result = -expression

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

Notes

You can use Operator_ Subtract to define the subtraction operation for custom classes and Operator_Negate to define the negation operation.

Sample Code

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

Var diff As Integer
diff = 50 - 30 // diff is 20

See Also

Operator_Subtract, Operator_Negate functions; Operator precedence