++

Arithmetic Operators

Arithmetic operators perform mathematical calculations on numeric values. The values they operate on are called operands, and the result is a new value.

For a broader introduction to operators, see Operators.

Addition#

The + operator adds two values together.

int a = 3;
int b = 4;
int result = a + b;  // 7
a = 3
b = 4
result = a + b  # 7
let a = 3;
let b = 4;
let result = a + b;  // 7

Subtraction#

The - operator subtracts the right operand from the left.