Skip to Content

Ruby - Numeric quo() function

Posted on

quo is a method defined on the Numeric class (and redefined in the Float class), which calculates the quotient of the receiver with the given argument.

In other words, x.quo(y) is roughly equivalent to x / y, but more precise.

3.1.2 :001 > 10.quo(7)
 => (10/7)
3.1.2 :002 > 10.quo(75)
 => (2/15)
3.1.2 :003 > 10.quo(20)
 => (1/2)
3.1.2 :004 >

References

comments powered by Disqus