Arithmetic & Type Coercion

Arithmetic & Type Coercion

Luma supports all standard arithmetic operators, offering expressive syntax with smart, developer-friendly type handling.

Supported Operators

Operator Description Example Result
+ Addition a + b Sum
- Subtraction a - b Diff
* Multiplication a * b Product
/ Division a / b Quotient
% Modulo (remainder of division) a % b Remainder
- Unary minus (negation) -a Negated value
++ Increment (adds 1 to integer) a++ a + 1
-- Decrement (subtracts 1 from integer) a– a - 1

Automatic Type Coercion

One of Luma’s most developer-friendly features is implicit numeric type coercion. This means:

  • Luma figures out type conversions for you based on the target variable type.
  • You don’t need to manually cast (int(), float()) when using mixed types like int and float.
Last updated on