This section provides some detail rules and a tutorial example on how arithmetic subtraction operation works in VBScript.

Here are some detail rules about the arithmetic operation - subtraction:

Arithmetic subtraction operation uses the subtraction operator: "-"

Arithmetic subtraction operation requires that at least one of the operands is a numeric subtype:
Byte, Integer, Long, Single or Double.

If an operand is not a numeric subtype, it will be converted into a numeric subtype.

The Boolean subtype is considered as a numeric subtype in a subtraction operation.
"True" represents a numeric value of -1. "False" represents a numeric value of 0.

The Empty subtype is considered as a numeric subtype in a subtraction operation.
"Empty" represents a numeric value of 0.

When a String value is used in a subtraction operation, it will be parsed into a Double value.
If the parsing process fails, the subtraction operation will raise the "Type mismatch" runtime error.

The returning value is the result of the first operand subtracted by the second operand.

The subtype of the returning value is determined by the returning value range and subtypes of operands.

Here is a tutorial example showing you how arithmetic subtraction operation rules work:

The output confirms some of arithmetic subtraction operation rules:

"3-7=-4 : Integer" shows that the result is an Integer value, because the result is small value and both operands are Integer values.

"3-777777=-777774 : Long" shows that the result is a Long value, because the result is large value outside the Integer value range.

"3-9.99=-6.99 : Double" shows that the result is a Double value, because the second operand is a Double value.
"9.99" is a Double literal. See the data literal section in the previous chapter.

"3-"7"=-4 : Double" shows that the result is a Double value, because the second operand is a Double value.
When a string is parsed into a numeric value, it returns a Double value.

The statement on (7-"7Hello") is commented out, because string "7Hello" can not parsed into a Double value.

"True-False=-1 : Integer" shows that VBScript recognizes True as -1 and False as 0.

By the way, arithmetic unary negation, works in the same way as subtraction, if you insert 0 before the "-" operator.