methods such as div, modulo, divmod, quo, and remainder.
puts 24.div 2 # division
puts (25.0).div(2.0) # result is integer
puts 12.modulo 5 # modulo
puts 12.modulo(5.0) # modulo with float
puts 12.divmod 5 # return array with quotient, modulus
puts 12.0.divmod 5.0 # with float
puts 12.quo 5 # return the quotient
puts 12.remainder 5 # return the remainder
Related examples in the same category