Mathematical Expressions

Scala’s mathematical “operators” are the same as other languages:

  • +
  • -
  • *
  • /
  • %

Because Scala is an OOP language, these aren’t really operators, they’re methods on the numeric data types.

When you use a var, you can also use these:

  • +=
  • -=
  • *=
  • /=
  • %

Example:

var a = 1
a += 10
a -= 1