wiki:LibraryNumber

Number methods

Numeric operators

  • +: adds two numbers
  • -: subtracts two numbers. If in front of a number, negates it (unary minus).
  • *: multiplies two numbers together
  • /: divides two numbers (second number must not be zero)
  • mod: integer remainder of two numbers
  • >>: right shift
  • <<: left shift

Comparison operators

  • <: less than
  • <=: less than or equals
  • ==: equal to
  • !=: not equal to
  • >=: greater than or equal to
  • >: greater than
  • and: bitwise and
  • or: bitwise or
  • not: bitwise not

(note: the operators coerce the right hand argument to number before performing the operation)

Methods

  • string: coerce number to string
  • print: output to standard output
  • range(to, step): returns a list containing the numbers from itself to to, inclusive. If step isn't provided, defaults to 1.
  • random: returns a random number from 0 to x, where x is the integer value of the current number object