This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

modulo

        # Integer.modulo

(from ruby core)
---
    modulo(p1)

---

Returns `self` modulo `other` as a real number.

For integer `n` and real number `r`, these expressions are equivalent:

    n % r
    n-r*(n/r).floor
    n.divmod(r)[1]

See Numeric#divmod.

Examples:

    10 % 2              # => 0
    10 % 3              # => 1
    10 % 4              # => 2

    10 % -2             # => 0
    10 % -3             # => -2
    10 % -4             # => -2

    10 % 3.0            # => 1.0
    10 % Rational(3, 1) # => (1/1)

Integer#modulo is an alias for Integer#%.


(This method is an alias for Integer#%.)

Returns `self` modulo `other` as a real number.

For integer `n` and real number `r`, these expressions are equivalent:

    n % r
    n-r*(n/r).floor
    n.divmod(r)[1]

See Numeric#divmod.

Examples:

    10 % 2              # => 0
    10 % 3              # => 1
    10 % 4              # => 2

    10 % -2             # => 0
    10 % -3             # => -2
    10 % -4             # => -2

    10 % 3.0            # => 1.0
    10 % Rational(3, 1) # => (1/1)

Integer#modulo is an alias for Integer#%.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.