Skip to content

Arithmetics

Aaron Niyonzima edited this page Sep 15, 2020 · 3 revisions

Arithmetic Operations

Arithmetic operations are done using the following operators:

  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Exponent (Power): ** or ^

The precedences are the same as in any other programming language: * and / have higher precedence than + and -. You can use ( ) to override them.

x = 2 + 3 * 4           ;* x = 14
// But
y = (2 + 3) * 4         ;* y = 20