-
| Syntax |
expression1 - expression2
|
| Action |
The arithmetic subtraction operator yields the difference of the values of expression1 and expression2.
|
| Examples |
3 - 0.5 » 2.5
The number 3 is "promoted" to a double, the type of 0.5, in order to perform the subtraction.
The subtraction operator works with strings; the result is the removal of the first occurrence of the second string from the first string.
The second string does not appear in the first, so nothing is removed. |
| Notes |
UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions need not be of the same type to be subtracted. Generally, the resulting type - which determines the method of subtraction - is the more complex type, the one that can most readily represent both values. The minus operator can also appear before a single operand to indicate arithmetic negation.
|
| See Also |
+
|