+ — addition and concatenation

Syntax and values

Behavior and details

The + operator works with two values. With Numbers it adds, with Text it joins the texts, and with Lists it makes a new outer list containing the items of both. Joining end to end is called concatenation. Both values must have the same one of these types. To join a number to text, first convert the number with text.

Here binary means “using two values,” such as the 2 and 3 in 2 + 3. It does not mean writing numbers in zeros and ones. Multiplication groups before addition: 2 + 3 * 4 means 2 + (3 * 4). See calculation order.

Example

# language: en
say 2 + 3 * 4
say "Pli" + "ro"
say([1, 2] + [3])

Syntax and values · Built-ins · Programming guides