Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Expressions > Binary arithmetic

Binary arithmetic

Type conversions may occur during arithmetic operations: arguments are converted to the highest type in common: float or int.

The Addition (+) operator yields the sum of the operands. If the operands are compatible sequences, it yields a new sequence with the operands concatenated.

The Addition (-) operator yields the difference of the operands.

The Multiplication (*) operator yields the product of the operands.

The Division (/) operator yields the quotient of the operands.

The Remainder (%) operator yields the remainder of the division of the first operand by the second operand.

The Concatenation (&) operator is not really an arithmetic operation; rather, it always results in a string by concatenating a string presentation of operands together.

  add-expr := expr "+" expr 
  add-expr := expr "-" expr 
  add-expr := expr "&" expr 

  mul-expr := expr "*" expr 
  mul-expr := expr "/" expr 
  mul-expr := expr "%" expr 
See also  | Expressions  | Assignments  | Grammar
Contributes notes:
Add a note
What's new | Anvil