Integers

Integer class is a built-in Ruby object instances of which (integers) are used to denote whole numbers e.g. -128, -64, 0, 1, 42, 43, 100.

Integers have many built-in methods. Some of the methods allow for basic arithmetic.

1 + 2  # Addition of 2 to 1. Gives 3.
1 - 2  # Subtraction of 2 from 1. Gives -1.
2 * 3  # Multiplication of 2 by 3. Gives 6.
10 / 2 # Division of 10 by 2. Gives 5.
2 ** 3 # Exponentiation of 2 to the power of 3. Gives 8.# 
10 % 6 # Remainder of division of 10 by 6 (modulo). Gives 4.