- — subtraction

Syntax and values

Behavior and details

The - between two Numbers subtracts the second from the first. This is binary subtraction: an operation using two values. A minus sign in front of just one value, such as -score, has the different job of reversing its sign.

A chain groups from left to right: 8 - 3 - 1 means (8 - 3) - 1, giving four. Text and Lists cannot be subtracted. Numbers and their result must be finite: no infinity or invalid numeric value.

Example

# language: en
say 8 - 3 - 1
say 8 - (3 - 1)

Syntax and values · Built-ins · Programming guides