method

remainder

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: Integer
remainder(p1) public

Returns the remainder after dividing int by numeric.

x.remainder(y) means x-y*(x/y).truncate.

5.remainder(3)     #=> 2
-5.remainder(3)    #=> -2
5.remainder(-3)    #=> 2
-5.remainder(-3)   #=> -2
5.remainder(1.5)   #=> 0.5

See Numeric#divmod.

Show source
Register or log in to add new notes.