Unary + — numeric identity

Syntax and values

Behavior and details

A unary operator works with one value. Unary + checks that its value is a Number and leaves it unchanged. For example, +5 is still five. It does not convert text such as "5" into a number.

The plus sign is a separate piece of source syntax, called a token. It is not part of the number literal itself. Unary signs group more tightly than multiplication. Use call parentheses when the first argument starts with +, such as say(+5).

Example

# language: en
say(+3)
say(+3 * 2)

Syntax and values · Built-ins · Programming guides