Numbers
Integers are unlimited. Use / for integer division on ints, fdiv or to_f for decimals and ** for powers.
Example
puts 7 / 2, 7 % 2, 7.fdiv(2), 2 ** 100
puts 3.14159.round(2), 10.divmod(3).inspect, 5.between?(1, 10)Result
3 1 3.5 1267650600228229401496703205376 3.14 [3, 1] true
Exercise
Float division.
7.(2)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.