Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Integerクラス > divmod

instance method Integer#divmod

divmod(other) -> [Integer, Numeric][permalink][rdoc]

self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にして返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。

[PARAM] other:
self を割る数。

[SEE_ALSO] Numeric#divmod